[LON-CAPA-cvs] cvs: loncom /interface/statistics lonproblemanalysis.pm lonstathelpers.pm lonstudentsubmissions.pm

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 16 Mar 2004 16:41:26 -0000


This is a MIME encoded message

--matthew1079455286
Content-Type: text/plain

matthew		Tue Mar 16 11:41:26 2004 EDT

  Modified files:              
    /loncom/interface/statistics	lonstathelpers.pm 
                                	lonproblemanalysis.pm 
                                	lonstudentsubmissions.pm 
  Log:
  Moved &GetStudentAnswers from lonstudentsubmissions and lonproblemanalysis
  to lonstathelpers.
  
  
--matthew1079455286
Content-Type: text/plain
Content-Disposition: attachment; filename="matthew-20040316114126.txt"

Index: loncom/interface/statistics/lonstathelpers.pm
diff -u loncom/interface/statistics/lonstathelpers.pm:1.8 loncom/interface/statistics/lonstathelpers.pm:1.9
--- loncom/interface/statistics/lonstathelpers.pm:1.8	Tue Mar 16 11:30:31 2004
+++ loncom/interface/statistics/lonstathelpers.pm	Tue Mar 16 11:41:26 2004
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstathelpers.pm,v 1.8 2004/03/16 16:30:31 matthew Exp $
+# $Id: lonstathelpers.pm,v 1.9 2004/03/16 16:41:26 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -339,6 +339,60 @@
     return ($prev,$curr,$next);
 }
 
+
+#####################################################
+#####################################################
+
+=pod
+
+=item GetStudentAnswers($r,$problem,$Students)
+
+Determines the correct answer for a set of students on a given problem.
+The students answers are stored in the student hashes pointed to by the
+array @$Students under the key 'answer'.
+
+Inputs: $r
+$problem: hash reference containing the keys 'resource', 'part', and 'respid'.
+$Students: reference to array containing student hashes (need 'username', 
+    'domain').  
+
+Returns: nothing 
+
+=cut
+
+#####################################################
+#####################################################
+sub GetStudentAnswers {
+    my ($r,$problem,$Students) = @_;
+    my $c = $r->connection();
+    my %Answers;
+    my ($resource,$partid,$respid) = ($problem->{'resource'},
+                                      $problem->{'part'},
+                                      $problem->{'respid'});
+    # Read in the cache (if it exists) before we start timing things.
+    &Apache::lonstathelpers::ensure_proper_cache($resource->{'symb'});
+    # Open progress window
+    my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
+        ($r,'Student Answer Compilation Status',
+         'Student Answer Compilation Progress', scalar(@$Students));
+    $r->rflush();
+    foreach my $student (@$Students) {
+        last if ($c->aborted());
+        my $sname = $student->{'username'};
+        my $sdom = $student->{'domain'};
+        my $answer = &Apache::lonstathelpers::analyze_problem_as_student
+            ($resource,$sname,$sdom,$partid,$respid);
+        &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
+                                                 &mt('last student'));
+        $student->{'answer'} = $answer;
+    }
+    &Apache::lonstathelpers::write_answer_cache();
+    return if ($c->aborted());
+    $r->rflush();
+    # close progress window
+    &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
+    return;
+}
 
 #####################################################
 #####################################################
Index: loncom/interface/statistics/lonproblemanalysis.pm
diff -u loncom/interface/statistics/lonproblemanalysis.pm:1.80 loncom/interface/statistics/lonproblemanalysis.pm:1.81
--- loncom/interface/statistics/lonproblemanalysis.pm:1.80	Tue Mar 16 11:30:31 2004
+++ loncom/interface/statistics/lonproblemanalysis.pm	Tue Mar 16 11:41:26 2004
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonproblemanalysis.pm,v 1.80 2004/03/16 16:30:31 matthew Exp $
+# $Id: lonproblemanalysis.pm,v 1.81 2004/03/16 16:41:26 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -205,7 +205,8 @@
     }
     #
     # This next call causes all the waiting around that people complain about
-    my ($max,$min) = &GetStudentAnswers($r,$problem,$Students);
+    my ($max,$min) = &Apache::lonstathelpers::GetStudentAnswers($r,$problem,
+                                                                $Students);
     return if ($c->aborted());
     #
     # Collate the data
@@ -306,38 +307,6 @@
 sub circle {
     my ($x,$y,$radius,$color,$thickness,$filled)=@_;
     return &arc($x,$y,$radius,$radius,0,360,$color,$thickness,$filled);
-}
-
-sub GetStudentAnswers {
-    my ($r,$problem,$Students) = @_;
-    my $c = $r->connection();
-    my %Answers;
-    my ($resource,$partid,$respid) = ($problem->{'resource'},
-                                      $problem->{'part'},
-                                      $problem->{'respid'});
-    # Read in the cache (if it exists) before we start timing things.
-    &Apache::lonstathelpers::ensure_proper_cache($resource->{'symb'});
-    # Open progress window
-    my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
-        ($r,'Student Answer Compilation Status',
-         'Student Answer Compilation Progress', scalar(@$Students));
-    $r->rflush();
-    foreach my $student (@$Students) {
-        last if ($c->aborted());
-        my $sname = $student->{'username'};
-        my $sdom = $student->{'domain'};
-        my $answer = &Apache::lonstathelpers::analyze_problem_as_student
-            ($resource,$sname,$sdom,$partid,$respid);
-        &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
-                                                 &mt('last student'));
-        $student->{'answer'} = $answer;
-    }
-    &Apache::lonstathelpers::write_answer_cache();
-    return if ($c->aborted());
-    $r->rflush();
-    # close progress window
-    &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
-    return;
 }
 
 sub build_student_data_worksheet {
Index: loncom/interface/statistics/lonstudentsubmissions.pm
diff -u loncom/interface/statistics/lonstudentsubmissions.pm:1.9 loncom/interface/statistics/lonstudentsubmissions.pm:1.10
--- loncom/interface/statistics/lonstudentsubmissions.pm:1.9	Tue Mar 16 11:30:32 2004
+++ loncom/interface/statistics/lonstudentsubmissions.pm	Tue Mar 16 11:41:26 2004
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstudentsubmissions.pm,v 1.9 2004/03/16 16:30:32 matthew Exp $
+# $Id: lonstudentsubmissions.pm,v 1.10 2004/03/16 16:41:26 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -153,7 +153,6 @@
     }
 }
 
-
 #########################################################
 #########################################################
 ##
@@ -171,7 +170,7 @@
               &mt('Preparing Excel spreadsheet of student responses').
               '</h2>');
     #
-    &GetStudentAnswers($r,$problem,$Students);
+    &Apache::lonstathelpers::GetStudentAnswers($r,$problem,$Students);
     #
     my @Columns = ( 'username','domain','attempt','time',
                     'submission','correct', 'grading','awarded','weight',
@@ -286,38 +285,6 @@
     $r->print('<p><a href="'.$filename.'">'.
               &mt('Your Excel spreadsheet.').
               '</a></p>'."\n");
-}
-
-sub GetStudentAnswers {
-    my ($r,$problem,$Students) = @_;
-    my $c = $r->connection();
-    my %Answers;
-    my ($resource,$partid,$respid) = ($problem->{'resource'},
-                                      $problem->{'part'},
-                                      $problem->{'respid'});
-    # Read in the cache (if it exists) before we start timing things.
-    &Apache::lonstathelpers::ensure_proper_cache($resource->{'symb'});
-    # Open progress window
-    my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
-        ($r,'Student Answer Compilation Status',
-         'Student Answer Compilation Progress', scalar(@$Students));
-    $r->rflush();
-    foreach my $student (@$Students) {
-        last if ($c->aborted());
-        my $sname = $student->{'username'};
-        my $sdom = $student->{'domain'};
-        my $answer = &Apache::lonstathelpers::analyze_problem_as_student
-            ($resource,$sname,$sdom,$partid,$respid);
-        &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
-                                                 &mt('last student'));
-        $student->{'answer'} = $answer;
-    }
-    &Apache::lonstathelpers::write_answer_cache();
-    return if ($c->aborted());
-    $r->rflush();
-    # close progress window
-    &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
-    return;
 }
 
 #########################################################

--matthew1079455286--