--- loncom/homework/grades.pm 2024/12/13 05:04:49 1.805
+++ loncom/homework/grades.pm 2025/06/28 14:35:00 1.811
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.805 2024/12/13 05:04:49 raeburn Exp $
+# $Id: grades.pm,v 1.811 2025/06/28 14:35:00 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -881,14 +881,20 @@ sub jscriptNform {
-# Given the score (as a number [0-1] and the weight) what is the final
-# point value? This function will round to the nearest tenth, third,
-# or quarter if one of those is within the tolerance of .00001.
+# Given the score (as a number [0-1], the weight, and a posible
+# reduction for submission between duedate and overduedate)
+# what is the final point value? This function will round to
+# the nearest tenth, third, or quarter if one of those is
+# within the tolerance of .00001.
sub compute_points {
- my ($score, $weight) = @_;
+ my ($score, $weight, $latefrac) = @_;
my $tolerance = .00001;
my $points = $score * $weight;
+ if (($latefrac ne '') &&
+ ($latefrac < 1) && ($latefrac >= 0)) {
+ $points = $points * $latefrac;
+ }
# Check for nearness to 1/x.
my $check_for_nearness = sub {
@@ -1263,18 +1269,18 @@ sub do_passback {
my $cdom = $env{"course.$env{'request.course.id'}.domain"};
my $cnum = $env{"course.$env{'request.course.id'}.num"};
my $crstype = &Apache::loncommon::course_type();
- my ($launcher,$appname,$setter,$linkuri,$linkprotector,$scope,$chosen);
+ my ($launchsymb,$appname,$setter,$linkuri,$linkprotector,$scope,$chosen);
if ($env{'form.passback'} ne '') {
$chosen = &unescape($env{'form.passback'});
($linkuri,$linkprotector,$scope) = split("\0",$chosen);
- ($launcher,$appname,$setter) = &get_passback_launcher($cdom,$cnum,$chosen);
+ ($launchsymb,$appname,$setter) = &get_passback_launcher($cdom,$cnum,$chosen);
}
- if ($launcher ne '') {
- $request->print(&launcher_info_box($launcher,$appname,$setter,$linkuri,$scope));
+ if ($launchsymb ne '') {
+ $request->print(&launcher_info_box($launchsymb,$appname,$setter,$linkuri,$scope));
}
my $error;
if ($perm{'mgr'}) {
- if ($launcher ne '') {
+ if ($launchsymb ne '') {
my @poss_students = &Apache::loncommon::get_env_multiple('form.stuinfo');
if (@poss_students) {
my %possibles;
@@ -1312,12 +1318,11 @@ sub do_passback {
if ($lti_in_use->{'scoreformat'} =~ /^(decimal|ratio|percentage)$/) {
$scoretype = $1;
}
- my $pbsymb = &Apache::loncommon::symb_from_tinyurl($linkuri,$cnum,$cdom);
my $pbmap;
- if ($pbsymb =~ /\.(page|sequence)$/) {
- $pbmap = &Apache::lonnet::deversion((&Apache::lonnet::decode_symb($pbsymb))[2]);
+ if ($launchsymb =~ /\.(page|sequence)$/) {
+ $pbmap = &Apache::lonnet::deversion((&Apache::lonnet::decode_symb($launchsymb))[2]);
} else {
- $pbmap = &Apache::lonnet::deversion((&Apache::lonnet::decode_symb($pbsymb))[0]);
+ $pbmap = &Apache::lonnet::deversion((&Apache::lonnet::decode_symb($launchsymb))[0]);
}
$pbmap = &Apache::lonnet::clutter($pbmap);
my $pbscope;
@@ -1332,13 +1337,13 @@ sub do_passback {
my $numstudents = scalar(keys(%tosend));
my %prog_state = &Apache::lonhtmlcommon::Create_PrgWin($request,$numstudents);
my $outcome = &Apache::loncommon::start_data_table().
- &Apache::loncommon::start_data_table_header_row();
+ &Apache::loncommon::start_data_table_header_row();
my $loop = 0;
while ($loop < 2) {
$outcome .= '