';
return $Str;
}
@@ -431,7 +430,7 @@ my @OutputOptions =
sub OutputDescriptions {
my $Str = '';
- $Str .= "
Output Formats
\n";
+ $Str .= '
'.&mt('Output Formats')."
\n";
$Str .= "
\n";
foreach my $outputmode (@OutputOptions) {
$Str .="
".$outputmode->{'name'}."
\n";
@@ -466,7 +465,7 @@ sub CreateAndParseOutputSelector {
$Str = qq/";
@@ -546,7 +545,7 @@ my @OutputDataOptions =
summary_table => 1,
maximum_row => 0,
ignore_weight => 1,
- shortdesc => 'Number of Problem Parts completed successfully.',
+ shortdesc => 'Number of Problem Parts completed successfully',
longdesc => 'The Number of Problem Parts completed successfully and '.
'the maximum possible for each student',
},
@@ -554,7 +553,7 @@ my @OutputDataOptions =
sub HTMLifyOutputDataDescriptions {
my $Str = '';
- $Str .= "
Output Data
\n";
+ $Str .= '
'.&mt('Output Data').'
'."\n";
$Str .= "
\n";
foreach my $option (@OutputDataOptions) {
$Str .= '
'.$option->{'name'}.'
';
@@ -583,7 +582,7 @@ sub CreateAndParseOutputDataSelector {
$Str = qq/";
@@ -663,26 +662,27 @@ sub html_initialize {
&Apache::lonstatistics::selected_sequences_with_assessments();
if (! ref($navmap)) {
# Unable to get data, so bail out
- $r->print("
".
- &mt('Unable to retrieve course information.').
- '
');
+ $r->print('
'
+ .&mt('Unable to retrieve course information.')
+ .'
');
}
# If we're showing links, show a checkbox to open in new
# windows.
if ($show_links ne 'no') {
- my $labeltext = &mt('Show links in new window:');
+ my $labeltext = &mt('Show links in new window');
$r->print(<new_window = true;
-');
}
#
# Deal with unimplemented requests
$request_aborted = undef;
if ($chosen_output->{'base'} =~ /final table/) {
- $r->print(<Unable to Complete Request
-
-The Summary Table (Scores) option is not available for non-HTML output.
-
-END
+ $r->print(
+ '
'.&mt('Unable to Complete Request').'
'
+ .'
'
+ .&mt('The [_1]Summary Table (Scores)[_2] option'
+ .' is not available for non-HTML output.','','')
+ .'
'
+ );
$request_aborted = 1;
}
return if ($request_aborted);
#
# Initialize progress window
my $studentcount = scalar(@Apache::lonstatistics::Students);
- %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
- ($r,'CSV File Compilation Status',
- 'CSV File Compilation Progress', $studentcount,
- 'inline',undef,'Statistics','stats_status');
+ %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,$studentcount);
#
# Open a file
($outputfile,$filename) = &Apache::loncommon::create_text_file($r,'csv');
@@ -1666,7 +1676,7 @@ END
# Datestamp
my $description = $env{'course.'.$env{'request.course.id'}.'.description'};
print $outputfile '"'.&Apache::loncommon::csv_translate($description).'",'.
- '"'.&Apache::loncommon::csv_translate(scalar(localtime(time))).'"'.
+ '"'.&Apache::loncommon::csv_translate(scalar(&Apache::lonlocal::locallocaltime(time))).'"'.
"\n";
print $outputfile '"'.
&Apache::loncommon::csv_translate
@@ -1706,23 +1716,23 @@ END
$sequence_row.='"",'x$count;
if ($chosen_output->{'sequence_sum'}) {
if($chosen_output->{'correct'}) {
- $resource_row .= '"sum",';
+ $resource_row .= '"'.&mt('sum').'",';
} else {
- $resource_row .= '"score",';
+ $resource_row .= '"'.&mt('score').'",';
}
}
if ($chosen_output->{'sequence_max'}) {
$sequence_row.= '"",';
- $resource_row .= '"maximum possible",';
+ $resource_row .= '"'.&mt('maximum possible').'",';
}
}
if ($chosen_output->{'grand_total'}) {
$sequence_row.= '"",';
- $resource_row.= '"Total",';
+ $resource_row.= '"'.&mt('Total').'",';
}
if ($chosen_output->{'grand_maximum'}) {
$sequence_row.= '"",';
- $resource_row.= '"Maximum",';
+ $resource_row.= '"'.&mt('Maximum').'",';
}
chomp($sequence_row);
chomp($resource_row);
@@ -1763,16 +1773,18 @@ sub csv_outputstudent {
my $total = 0;
my $maximum = 0;
foreach my $seq (@sequences) {
+ my $randompick = $seq->randompick();
my ($performance,$performance_length,$score,$seq_max,$rawdata);
if ($chosen_output->{'tries'}){
($performance,$performance_length,$score,$seq_max,$rawdata) =
&student_tries_on_sequence($student,\%StudentsData,
- $navmap,$seq,'no');
+ $navmap,$seq,'no',$randompick);
} else {
($performance,$performance_length,$score,$seq_max,$rawdata) =
&student_performance_on_sequence($student,\%StudentsData,
$navmap,$seq,'no',
- $chosen_output->{ignore_weight});
+ $chosen_output->{ignore_weight},
+ $randompick);
}
if ($chosen_output->{'every_problem'}) {
if ($chosen_output->{'correct'}) {
@@ -1873,7 +1885,7 @@ Inputs:
#######################################################
#######################################################
sub student_tries_on_sequence {
- my ($student,$studentdata,$navmap,$seq,$links) = @_;
+ my ($student,$studentdata,$navmap,$seq,$links,$randompick) = @_;
$links = 'no' if (! defined($links));
my $Str = '';
my ($sum,$max) = (0,0);
@@ -1959,17 +1971,17 @@ sub student_tries_on_sequence {
($links eq 'all')) {
my $link = '/adm/grades'.
'?symb='.&escape($resource->shown_symb).
- '&student='.$student->{'username'}.
- '&userdom='.$student->{'domain'}.
- '&command=submission';
+ '&student='.$student->{'username'}.
+ '&userdom='.$student->{'domain'}.
+ '&command=submission';
$symbol = &link($symbol, $link);
}
$value .= $symbol;
}
$Str .= $value;
}
- if ($seq->randompick()) {
- $max = $seq->randompick();
+ if ($randompick) {
+ $max = $randompick;
}
if (! $hasdata && $sum == 0) {
$sum = ' ';
@@ -2034,7 +2046,7 @@ Inputs:
#######################################################
#######################################################
sub student_performance_on_sequence {
- my ($student,$studentdata,$navmap,$seq,$links,$awarded_only) = @_;
+ my ($student,$studentdata,$navmap,$seq,$links,$awarded_only,$randompick) = @_;
$links = 'no' if (! defined($links));
my $Str = ''; # final result string
my ($score,$max) = (0,0);
@@ -2043,9 +2055,11 @@ sub student_performance_on_sequence {
my @ScoreData = ();
my $partscore;
my $hasdata = 0; # flag, 0 if there were no submissions on the sequence
+ my %ptsfreq;
foreach my $resource (&get_resources($navmap,$seq)) {
my $symb = $resource->symb;
my $resource_data = $studentdata->{$symb};
+ my $resmax = 0;
foreach my $part (@{$resource->parts()}) {
$partscore = undef;
my $weight;
@@ -2061,6 +2075,7 @@ sub student_performance_on_sequence {
}
#
$max += $weight; # see the 'excused' branch below...
+ $resmax += $weight;
$performance_length++; # one character per part
$symbol = ' '; # default to space
#
@@ -2114,13 +2129,24 @@ sub student_performance_on_sequence {
if ( ($links eq 'yes' && $symbol ne ' ') || ($links eq 'all')) {
my $link = '/adm/grades' .
'?symb='.&escape($resource->shown_symb).
- '&student='.$student->{'username'}.
- '&userdom='.$student->{'domain'}.
- '&command=submission';
+ '&student='.$student->{'username'}.
+ '&userdom='.$student->{'domain'}.
+ '&command=submission';
$symbol = &link($symbol, $link);
}
$Str .= $symbol;
}
+ if ($ptsfreq{$resmax}) {
+ $ptsfreq{$resmax} ++;
+ } else {
+ $ptsfreq{$resmax} = 1;
+ }
+ }
+ if ($randompick) {
+ my @uniquetotals = keys(%ptsfreq);
+ if ((@uniquetotals = 1) && ($ptsfreq{$uniquetotals[0]} > 0)) {
+ $max = $max * $randompick/$ptsfreq{$uniquetotals[0]};
+ }
}
if (! $hasdata && $score == 0) {
$score = ' ';