Diff for /loncom/homework/grades.pm between versions 1.808 and 1.811

version 1.808, 2025/01/18 21:14:59 version 1.811, 2025/06/28 14:35:00
Line 881  sub jscriptNform { Line 881  sub jscriptNform {
   
   
   
 # Given the score (as a number [0-1] and the weight) what is the final  # Given the score (as a number [0-1], the weight, and a posible 
 # point value? This function will round to the nearest tenth, third,  # reduction for submission between duedate and overduedate)
 # or quarter if one of those is within the tolerance of .00001.  # 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 {  sub compute_points {
     my ($score, $weight) = @_;      my ($score, $weight, $latefrac) = @_;
           
     my $tolerance = .00001;      my $tolerance = .00001;
     my $points = $score * $weight;      my $points = $score * $weight;
       if (($latefrac ne '') && 
           ($latefrac < 1) && ($latefrac >= 0))  {
           $points = $points * $latefrac;
       }
   
     # Check for nearness to 1/x.      # Check for nearness to 1/x.
     my $check_for_nearness = sub {      my $check_for_nearness = sub {
Line 2951  sub gradeBox { Line 2957  sub gradeBox {
                            : '<span class="LC_info">'.&mt('problem weight assigned by computer').'</span>';                             : '<span class="LC_info">'.&mt('problem weight assigned by computer').'</span>';
     $wgt       = ($wgt > 0 ? $wgt : '1');      $wgt       = ($wgt > 0 ? $wgt : '1');
     my $score  = ($$record{'resource.'.$partid.'.awarded'} eq '' ?      my $score  = ($$record{'resource.'.$partid.'.awarded'} eq '' ?
   '' : &compute_points($$record{'resource.'.$partid.'.awarded'},$wgt));    '' : &compute_points($$record{'resource.'.$partid.'.awarded'},$wgt,
                          $$record{'resource.'.$partid.'.latefrac'}));
     my $data_WGT='<input type="hidden" name="WGT'.$counter.'_'.$partid.'" value="'.$wgt.'" />'."\n";      my $data_WGT='<input type="hidden" name="WGT'.$counter.'_'.$partid.'" value="'.$wgt.'" />'."\n";
     my $display_part= &get_display_part($partid,$symb);      my $display_part= &get_display_part($partid,$symb);
     my %last_resets = &get_last_resets($symb,$env{'request.course.id'},      my %last_resets = &get_last_resets($symb,$env{'request.course.id'},
Line 4472  sub saveHandGrade { Line 4479  sub saveHandGrade {
     my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$domain,$stuname);      my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$domain,$stuname);
     my @parts_graded;      my @parts_graded;
     my %newrecord  = ();      my %newrecord  = ();
     my ($pts,$wgt,$totchg,$sendupdate,$posspb) = ('','',0,0,0);      my ($pts,$wgt,$totchg,$sendupdate,$poss_pb) = ('','',0,0,0);
     my %aggregate = ();      my %aggregate = ();
     my $aggregateflag = 0;      my $aggregateflag = 0;
     if ($env{'form.HIDE'.$newflg}) {      if ($env{'form.HIDE'.$newflg}) {
Line 4491  sub saveHandGrade { Line 4498  sub saveHandGrade {
  my $dropMenu = $env{'form.GD_SEL'.$newflg.'_'.$new_part};   my $dropMenu = $env{'form.GD_SEL'.$newflg.'_'.$new_part};
         if ($poss_pb) {          if ($poss_pb) {
             $weights{$symb}{$new_part} =              $weights{$symb}{$new_part} =
                 &Apache::lonnet::EXT('resource.'.$new_part.'.weight',$symb,$udom,$uname);                  &Apache::lonnet::EXT('resource.'.$new_part.'.weight',$symb,$domain,$stuname);
         } elsif ($env{'form.WGT'.$newflg.'_'.$new_part} eq '') {          } elsif ($env{'form.WGT'.$newflg.'_'.$new_part} eq '') {
             $weights{$symb}{$new_part} = 1;              $weights{$symb}{$new_part} = 1;
         } else {          } else {
Line 5419  sub viewstudentgrade { Line 5426  sub viewstudentgrade {
     foreach my $apart (@$parts) {      foreach my $apart (@$parts) {
  my ($part,$type) = &split_part_type($apart);   my ($part,$type) = &split_part_type($apart);
  my $score=$record{"resource.$part.$type"};   my $score=$record{"resource.$part.$type"};
           my $latefrac=$record{"resource.$part.latefrac"};
         $result.='<td align="center">';          $result.='<td align="center">';
         my ($aggtries,$totaltries);          my ($aggtries,$totaltries);
         unless (exists($aggregates{$part})) {          unless (exists($aggregates{$part})) {
Line 5435  sub viewstudentgrade { Line 5443  sub viewstudentgrade {
             $aggregates{$part} = 1;              $aggregates{$part} = 1;
         }          }
  if ($type eq 'awarded') {   if ($type eq 'awarded') {
     my $pts = $score eq '' ? '' : &compute_points($score,$$weight{$part});      my $pts = $score eq '' ? '' : &compute_points($score,$$weight{$part},$latefrac);
     $result.='<input type="hidden" name="'.      $result.='<input type="hidden" name="'.
  'GD_'.$student.'_'.$part.'_awarded_s" value="'.$pts.'" />'."\n";   'GD_'.$student.'_'.$part.'_awarded_s" value="'.$pts.'" />'."\n";
     $result.='<input type="text" name="'.      $result.='<input type="text" name="'.

Removed from v.1.808  
changed lines
  Added in v.1.811


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>