version 1.807, 2025/01/18 05:06:35
|
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 4463 sub processHandGrade {
|
Line 4470 sub processHandGrade {
|
|
|
#---- Save the score and award for each student, if changed |
#---- Save the score and award for each student, if changed |
sub saveHandGrade { |
sub saveHandGrade { |
my ($request,$symb,$stuname,$domain,$newflg,$submitter,$part,$queueable,$needpb,$skip_passback,$pbsave) = @_; |
my ($request,$symb,$stuname,$domain,$newflg,$submitter, |
|
$part,$queueable,$needpb,$skip_passback,$pbsave) = @_; |
my @version_parts; |
my @version_parts; |
my $usec = &Apache::lonnet::getsection($domain,$stuname, |
my $usec = &Apache::lonnet::getsection($domain,$stuname, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
Line 4471 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) = ('','',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 4479 sub saveHandGrade {
|
Line 4487 sub saveHandGrade {
|
my $numchgs = &makehidden($version,$parts,\%record,$symb,$domain,$stuname,1); |
my $numchgs = &makehidden($version,$parts,\%record,$symb,$domain,$stuname,1); |
$totchg += $numchgs; |
$totchg += $numchgs; |
} |
} |
|
if ((ref($needpb) eq 'HASH') && (keys(%{$needpb}))) { |
|
$poss_pb = 1; |
|
} |
my (%weights,%awardeds,%excuseds); |
my (%weights,%awardeds,%excuseds); |
my @parts = split(/:/,$env{'form.partlist'.$newflg}); |
my @parts = split(/:/,$env{'form.partlist'.$newflg}); |
foreach my $new_part (@parts) { |
foreach my $new_part (@parts) { |
#collaborator ($submitter may vary for different parts) |
#collaborator ($submitter may vary for different parts) |
if ($submitter && $new_part ne $part) { next; } |
if ($submitter && $new_part ne $part) { next; } |
my $dropMenu = $env{'form.GD_SEL'.$newflg.'_'.$new_part}; |
my $dropMenu = $env{'form.GD_SEL'.$newflg.'_'.$new_part}; |
if ($env{'form.WGT'.$newflg.'_'.$new_part} eq '') { |
if ($poss_pb) { |
|
$weights{$symb}{$new_part} = |
|
&Apache::lonnet::EXT('resource.'.$new_part.'.weight',$symb,$domain,$stuname); |
|
} elsif ($env{'form.WGT'.$newflg.'_'.$new_part} eq '') { |
$weights{$symb}{$new_part} = 1; |
$weights{$symb}{$new_part} = 1; |
} else { |
} else { |
$weights{$symb}{$new_part} = $env{'form.WGT'.$newflg.'_'.$new_part}; |
$weights{$symb}{$new_part} = $env{'form.WGT'.$newflg.'_'.$new_part}; |
Line 4596 sub saveHandGrade {
|
Line 4610 sub saveHandGrade {
|
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, |
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, |
$cdom,$cnum); |
$cdom,$cnum); |
} |
} |
if (($sendupdate || $totchg) && (!$submitter)) { |
if (($sendupdate || $totchg) && (!$submitter) && ($poss_pb)) { |
if ((ref($needpb) eq 'HASH') && |
&process_passbacks('handgrade',[$symb],$cdom,$cnum,$domain,$stuname,$usec,\%weights, |
(keys(%{$needpb}))) { |
\%awardeds,\%excuseds,$needpb,$skip_passback,$pbsave); |
&process_passbacks('handgrade',[$symb],$cdom,$cnum,$domain,$stuname,$usec,\%weights, |
|
\%awardeds,\%excuseds,$needpb,$skip_passback,$pbsave); |
|
} |
|
} |
} |
return ('',$pts,$wgt,$totchg,$sendupdate); |
return ('',$pts,$wgt,$totchg,$sendupdate); |
} |
} |
Line 5415 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 5431 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="'. |