').$similar."\n"
@@ -1596,7 +1600,7 @@ sub get_last_submission {
}
}
}
- @string = $string[0] eq '' ? 'Nothing submitted - no attempts.' : @string;
+ @string = $string[0] eq '' ? 'Nothing submitted - no attempts.' : @string;
return \@string,\$timestamp;
}
@@ -1766,7 +1770,7 @@ sub processHandGrade {
}
}
$ctr = 0;
- my ($partlist,$handgrade) = &response_type($ENV{'form.url'});
+ my ($partlist,$handgrade) = &response_type($ENV{'form.url'},$symb);
@parsedlist = reverse @parsedlist if ($button eq 'Previous');
foreach my $student (@parsedlist) {
my ($uname,$udom) = split(/:/,$student);
@@ -1815,14 +1819,23 @@ sub saveHandGrade {
my %newrecord = ();
my ($pts,$wgt) = ('','');
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) {
- if ($ENV{'form.GD_SEL'.$newflg.'_'.$_} eq 'excused') {
+ my $dropMenu = $ENV{'form.GD_SEL'.$newflg.'_'.$_};
+ if ($dropMenu eq 'excused') {
if ($record{'resource.'.$_.'.solved'} ne 'excused') {
$newrecord{'resource.'.$_.'.solved'} = 'excused';
if (exists($record{'resource.'.$_.'.awarded'})) {
$newrecord{'resource.'.$_.'.awarded'} = '';
}
+ $newrecord{'resource.'.$_.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
}
- } else {
+ } elsif ($dropMenu eq 'reset status'
+ && exists($record{'resource.'.$_.'.solved'})) { #don't bother if no old records -> no attempts
+ $newrecord{'resource.'.$_.'.tries'} = 0;
+ $newrecord{'resource.'.$_.'.solved'} = '';
+ $newrecord{'resource.'.$_.'.award'} = '';
+ $newrecord{'resource.'.$_.'.awarded'} = 0;
+ $newrecord{'resource.'.$_.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
+ } elsif ($dropMenu eq '') {
$pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ?
$ENV{'form.GD_BOX'.$newflg.'_'.$_} :
$ENV{'form.RADVAL'.$newflg.'_'.$_});
@@ -1865,10 +1878,10 @@ sub viewgrades_js {
$request->print(<
function writePoint(partid,weight,point) {
- var radioButton = eval("document.classgrade.RADVAL_"+partid);
- var textbox = eval("document.classgrade.TEXTVAL_"+partid);
+ var radioButton = document.classgrade["RADVAL_"+partid];
+ var textbox = document.classgrade["TEXTVAL_"+partid];
if (point == "textval") {
- var point = eval("document.classgrade.TEXTVAL_"+partid+".value");
+ point = document.classgrade["TEXTVAL_"+partid].value;
if (isNaN(point) || parseFloat(point) < 0) {
alert("A number equal or greater than 0 is expected. Entered value = "+parseFloat(point));
var resetbox = false;
@@ -1899,15 +1912,13 @@ sub viewgrades_js {
}
} else {
- textbox.value = point;
+ textbox.value = parseFloat(point);
}
for (i=0;i'."\n".
''."\n".
''."\n".
+ ''."\n".
''."\n";
$result.='
Assign Common Grade To ';
@@ -2062,7 +2071,7 @@ sub viewgrades {
'
';
#radio buttons/text box for assigning points for a section or class.
#handles different parts of a problem
- my ($partlist,$handgrade) = &response_type($ENV{'form.url'});
+ my ($partlist,$handgrade) = &response_type($url,$symb);
my %weight = ();
my $ctsparts = 0;
$result.='
'."\n";
$request->print($result);
@@ -2991,7 +3021,7 @@ sub updateGradeByPage {
my $studentTable='
'.
'
'.
- '
No
'.
+ '
Prob.
'.
'
Title
'.
'
Previous Score
'.
'
New Score
';
@@ -3023,31 +3053,40 @@ sub updateGradeByPage {
my $score;
if ($partial > 0) {
$score = 'correct_by_override';
- } elsif ($partial == 0) {
+ } elsif ($newpts ne '') { #empty is taken as 0
$score = 'incorrect_by_override';
}
- if ($ENV{'form.GD_SEL'.$question.'_'.$partid} eq 'excused') {
+ my $dropMenu = $ENV{'form.GD_SEL'.$question.'_'.$partid};
+ if ($dropMenu eq 'excused') {
$partial = '';
$score = 'excused';
+ } elsif ($dropMenu eq 'reset status'
+ && $ENV{'form.solved'.$question.'_'.$partid} ne '') { #update only if previous record exists
+ print "got to reset = $ENV{'form.solved'.$question.'_'.$partid}: ";
+ $newrecord{'resource.'.$partid.'.tries'} = 0;
+ $newrecord{'resource.'.$partid.'.solved'} = '';
+ $newrecord{'resource.'.$partid.'.award'} = '';
+ $newrecord{'resource.'.$partid.'.awarded'} = 0;
+ $newrecord{'resource.'.$partid.'.regrader'} = "$ENV{'user.name'}:$ENV{'user.domain'}";
+ $changeflag++;
+ $newpts = '';
}
+
my $oldstatus = $ENV{'form.solved'.$question.'_'.$partid};
$displayPts[0].=' Part '.$partid.' = '.
(($oldstatus eq 'excused') ? 'excused' : $oldpts).
' ';
$displayPts[1].=' Part '.$partid.' = '.
- ($oldstatus eq 'correct_by_student' ? $oldpts :
- (($score eq 'excused') ? 'excused' : $newpts)).
+ (($score eq 'excused') ? 'excused' : $newpts).
' ';
$question++;
- if (($oldstatus eq 'correct_by_student') ||
- ($newpts eq $oldpts && $score eq $oldstatus))
- {
- next;
- }
+ next if ($dropMenu eq 'reset status' || ($newpts == $oldpts && $score ne 'excused'));
+
$newrecord{'resource.'.$partid.'.awarded'} = $partial if $partial ne '';
- $newrecord{'resource.'.$partid.'.solved'} = $score;
- $newrecord{'resource.'.$partid.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
+ $newrecord{'resource.'.$partid.'.solved'} = $score if $score ne '';
+ $newrecord{'resource.'.$partid.'.regrader'} = "$ENV{'user.name'}:$ENV{'user.domain'}"
+ if (scalar(keys(%newrecord)) > 0);
$changeflag++;
}
@@ -3055,6 +3094,7 @@ sub updateGradeByPage {
&Apache::lonnet::cstore(\%newrecord,$symbx,$ENV{'request.course.id'},
$udom,$uname);
}
+
$studentTable.='
'.$displayPts[0].'
'.
'
'.$displayPts[1].'
'.
'';
@@ -3396,7 +3436,7 @@ SCANTRONFORM
#--- Show a Grading Menu button - Calls the next routine ---
sub show_grading_menu_form {
my ($symb,$url)=@_;
- my $result.='