--- loncom/interface/statistics/lonstudentsubmissions.pm 2004/02/20 16:38:49 1.3
+++ loncom/interface/statistics/lonstudentsubmissions.pm 2004/06/04 21:42:18 1.11
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonstudentsubmissions.pm,v 1.3 2004/02/20 16:38:49 matthew Exp $
+# $Id: lonstudentsubmissions.pm,v 1.11 2004/06/04 21:42:18 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -43,10 +43,6 @@ my @SubmitButtons = ({ name => 'PrevProb
{ name => 'NextProblem',
text => 'Next Problem' },
{ name => 'break'},
- { name => 'ClearCache',
- text => 'Clear Caches' },
- { name => 'updatecaches',
- text => 'Update Student Data' },
{ name => 'SelectAnother',
text => 'Choose a different Problem' },
{ name => 'Generate',
@@ -75,18 +71,8 @@ sub BuildStudentSubmissionsPage {
$r->print('
There are no students in the sections selected ');
}
#
- &Apache::loncoursedata::clear_internal_caches();
- if (exists($ENV{'form.ClearCache'}) ||
- exists($ENV{'form.updatecaches'}) ||
- (exists($ENV{'form.firstanalysis'}) &&
- $ENV{'form.firstanalysis'} ne 'no')) {
- &Apache::lonstatistics::Gather_Full_Student_Data($r);
- }
- if (! exists($ENV{'form.firstanalysis'})) {
- $r->print(' ');
- } else {
- $r->print(' ');
- }
+ my @CacheButtonHTML =
+ &Apache::lonstathelpers::manage_caches($r,'Statistics','stats_status');
$r->rflush();
#
if (exists($ENV{'form.problemchoice'}) &&
@@ -100,6 +86,9 @@ sub BuildStudentSubmissionsPage {
$r->print(' 'x5);
}
}
+ foreach my $html (@CacheButtonHTML) {
+ $r->print($html.(' 'x5));
+ }
#
$r->print(' ');
$r->rflush();
@@ -153,7 +142,6 @@ sub BuildStudentSubmissionsPage {
}
}
-
#########################################################
#########################################################
##
@@ -163,6 +151,7 @@ sub BuildStudentSubmissionsPage {
#########################################################
sub prepare_excel_output {
my ($r,$problem,$ProblemData,$Students) = @_;
+ my $c = $r->connection();
my ($resource,$respid,$partid) = ($problem->{'resource'},
$problem->{'respid'},
$problem->{'part'});
@@ -170,8 +159,14 @@ sub prepare_excel_output {
&mt('Preparing Excel spreadsheet of student responses').
'');
#
- &GetStudentAnswers($r,$problem,$Students);
+ &Apache::lonstathelpers::GetStudentAnswers($r,$problem,$Students,
+ 'Statistics','stats_status');
#
+ $r->print('');
+ $r->rflush();
my @Columns = ( 'username','domain','attempt','time',
'submission','correct', 'grading','awarded','weight',
'score');
@@ -209,6 +204,7 @@ sub prepare_excel_output {
#
# Populate the worksheet with the student data
foreach my $student (@$Students) {
+ last if ($c->aborted());
my $results = &Apache::loncoursedata::get_response_data_by_student
($student,$resource->{'symb'},$respid);
my %row;
@@ -284,37 +280,13 @@ sub prepare_excel_output {
$r->print(''.
&mt('Your Excel spreadsheet.').
'
'."\n");
-}
-
-sub GetStudentAnswers {
- my ($r,$problem,$Students) = @_;
- my %Answers;
- my ($resource,$partid,$respid) = ($problem->{'resource'},
- $problem->{'part'},
- $problem->{'respid'});
- # Open progress window
- my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
- ($r,'Student Answer Compilation Status',
- 'Student Answer Compilation Progress', scalar(@$Students));
- $r->print("\n");
- $r->rflush();
- foreach my $student (@$Students) {
- my $sname = $student->{'username'};
- my $sdom = $student->{'domain'};
- my $answer = &Apache::lonstathelpers::analyze_problem_as_student
- ($resource,$sname,$sdom,$partid,$respid);
- &Apache::lonnet::logthis('answer = "'.$answer.'"');
- &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
- &mt('last student'));
- $student->{'answer'} = $answer;
- }
- $r->print("
\n");
+ $r->print('');
$r->rflush();
- # close progress window
- &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
- return;
-}
+}
#########################################################
#########################################################
@@ -328,15 +300,14 @@ sub CreateInterface {
## Environment variable initialization
my $Str = '';
$Str .= &Apache::lonhtmlcommon::breadcrumbs
- (undef,&mt('Student Submission Reports'));
+ (undef,'Student Submission Reports');
+ $Str .= '';
$Str .= '
'."\n";
$Str .= '';
$Str .= ''.&mt('Sections').' ';
$Str .= ''.&mt('Enrollment Status').' ';
- $Str .= ' ';
$Str .= ' '."\n";
- ##
- ##
+ #
$Str .= ''."\n";
$Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5);
$Str .= ' ';
@@ -345,24 +316,14 @@ sub CreateInterface {
$Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5);
$Str .= '';
#
- my $only_seq_with_assessments = sub {
- my $s=shift;
- if ($s->{'num_assess'} < 1) {
- return 0;
- } else {
- return 1;
- }
- };
- ##
- ##
$Str .= ' '."\n";
$Str .= '
'."\n";
#
- # We do this to make sure the sequence information is initialized
- &Apache::lonstatistics::MapSelect('Maps','multiple,all',5,
- $only_seq_with_assessments);
-
- #
+ $Str .= ''.&mt('Status: [_1]',
+ ' ').
+ ' '.'';
+ ##
return $Str;
}