[LON-CAPA-cvs] cvs: loncom /interface/statistics lonstudentassessment.pm

minaeibi lon-capa-cvs@mail.lon-capa.org
Thu, 24 Oct 2002 20:58:07 -0000


This is a MIME encoded message

--minaeibi1035493087
Content-Type: text/plain

minaeibi		Thu Oct 24 16:58:07 2002 EDT

  Modified files:              
    /loncom/interface/statistics	lonstudentassessment.pm 
  Log:
  started to fix a bug
  
  
--minaeibi1035493087
Content-Type: text/plain
Content-Disposition: attachment; filename="minaeibi-20021024165807.txt"

Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.16 loncom/interface/statistics/lonstudentassessment.pm:1.17
--- loncom/interface/statistics/lonstudentassessment.pm:1.16	Wed Oct 23 17:04:26 2002
+++ loncom/interface/statistics/lonstudentassessment.pm	Thu Oct 24 16:58:06 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # (Publication Handler
 #
-# $Id: lonstudentassessment.pm,v 1.16 2002/10/23 21:04:26 minaeibi Exp $
+# $Id: lonstudentassessment.pm,v 1.17 2002/10/24 20:58:06 minaeibi Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -104,13 +104,13 @@
     $r->print('<pre>'."\n");
     foreach (@$students) {
         if($c->aborted()) { return $Str; }
-        next if ($_ ne $selectedName && 
+        next if ($_ ne $selectedName &&
                  $selectedName ne 'All Students');
         $selected = 1;
 
         my @who = ($_);
-        next if(&Apache::loncoursedata::DownloadStudentCourseData(\@who, 'true', 
-                                                             $cacheDB, 'true', 
+        next if(&Apache::loncoursedata::DownloadStudentCourseData(\@who, 'true',
+                                                             $cacheDB, 'true',
                                                              'false', $courseID,
                                                              $r, $c) ne 'OK');
         next if($c->aborted());
@@ -166,7 +166,8 @@
     }
 
 
-    $r->print(&StudentReport(\%cache, "AvgTotal", $spacing, $sequenceKeys));
+#    $r->print("AverageTtal");
+    $r->print(&StudentAverageTotal(\%cache, $spacing, $sequenceKeys));
     $r->print("\n");
     $r->rflush();
     untie(%cache);
@@ -193,7 +194,7 @@
     $Str .= '<input type="submit" name="PreviousStudent" ';
     $Str .= 'value="Previous Student" />'."\n";
     $Str .= '&nbsp&nbsp&nbsp'."\n";
-    $Str .= &Apache::lonhtmlcommon::StudentOptions($cache, $students, 
+    $Str .= &Apache::lonhtmlcommon::StudentOptions($cache, $students,
                                                    $selectedName, 
                                                    'StudentAssessment', 
                                                    $formName);
@@ -239,7 +240,7 @@
     my $displayString = '<td align="left"><pre><a href="/adm/statistics?';
     $displayString .= 'sort=LINKDATA">DISPLAYDATA</a>FORMATTING';
     $displayString .= $spacing.'</pre></td>'."\n";
-    $Str .= &Apache::lonhtmlcommon::CreateHeadings($cache, 
+    $Str .= &Apache::lonhtmlcommon::CreateHeadings($cache,
                                                    $infoKeys,
                                                    $infoHeadings,
                                                    $displayString,
@@ -342,7 +343,92 @@
         }
 
         # Output the number of correct answers for the current sequence.
-        # This part takes up 6 character slots, but is formated right 
+        # This part takes up 6 character slots, but is formated right
+        # justified.
+        my $spacesNeeded=$cache->{$sequence.':columnWidth'}-$characterCount;
+        $spacesNeeded -= 3;
+        $Str .= (' 'x$spacesNeeded);
+
+#        my $outputProblemsCorrect = sprintf("%3d", $cache->{$name.':'.$sequence.
+#							    ':problemsCorrect'});
+
+	my $outputProblemsCorrect = sprintf("%2d/%2d", $cache->{$name.':'.$sequence.
+                                            ':problemsCorrect'},
+                                            $characterCount);
+        if($hasData eq 'true') {
+            $Str .= '<font color="#007700">'.$outputProblemsCorrect.'</font>';
+            $hasFinalData = 'true';
+        } else {
+            $Str .= '<font color="#007700">     </font>';
+        }
+        $Str .= $spacing;
+    }
+
+    # Output the total correct problems over the total number of problems.
+    # I don't like this type of formatting, but it is a solution.  Need
+    # a way to dynamically determine the space requirements.
+    my $outputProblemsSolved = sprintf("%4d", $cache->{$name.':problemsSolved'});
+    my $outputTotalProblems  = sprintf("%4d", $cache->{$name.':totalProblems'});
+    if($hasFinalData eq 'true') {
+        $Str .= '<font color="#000088">'.$outputProblemsSolved.
+	    ' / '.$outputTotalProblems.'</font>';
+    } else {
+        $Str .= '<font color="#000088">           </font>';
+    }
+
+    if($hasVersion eq 'false') {
+        $Str = '<b><font color="blue">No course data.</font></b>';
+    }
+
+    return $Str;
+}
+
+
+sub StudentAverageTotal {
+    
+    return "";
+
+    my ($cache,$name,$spacing,$showSequences)=@_;
+    my $username = $name;
+    my $Str = '';
+    my $hasVersion = 'false';
+    my $hasFinalData = 'false';
+    foreach my $sequence (@$showSequences) {
+        my $hasData = 'false';
+        my $characterCount=0;
+        foreach my $problemID (split(':', $cache->{$sequence.':problems'})) {
+            my $problem = $cache->{$problemID.':problem'};
+            # All grades (except for versionless parts) are displayed as links
+            # to their submission record.  Loop through all the parts for the
+            # current problem in the correct order and prepare the output links
+            foreach(split(/\:/,$cache->{$sequence.':'.$problemID.
+                                        ':parts'})) {
+                if($cache->{$name.':'.$problemID.':NoVersion'} eq 'true' ||
+                   $cache->{$name.':'.$problemID.':'.$_.':code'} eq ' ' ||
+                   $cache->{$name.':'.$problemID.':'.$_.':code'} eq '') {
+                    $Str .= ' ';
+                    $characterCount++;
+                    next;
+                }
+                $hasVersion = 'true';
+                $hasData = 'true';
+                $Str .= '<a href="/adm/grades?symb=';
+                $Str .= &Apache::lonnet::escape($problem);
+                $Str .= '&student= Average &domain= Total';
+                $Str .= '&command=submission">';
+                my $code = $cache->{$name.':'.$problemID.':'.$_.':code'};
+                my $tries = $cache->{$name.':'.$problemID.':'.$_.':tries'};
+                if($code eq '*' && $tries < 10 && $tries ne '') {
+                    $code = $tries;
+                }
+                $Str .= $code;
+                $Str .= '</a>';
+                $characterCount++;
+            }
+        }
+
+        # Output the number of correct answers for the current sequence.
+        # This part takes up 6 character slots, but is formated right
         # justified.
         my $spacesNeeded=$cache->{$sequence.':columnWidth'}-$characterCount;
         $spacesNeeded -= 3;
@@ -352,7 +438,7 @@
 #							    ':problemsCorrect'});
 
 	my $outputProblemsCorrect = sprintf("%2d/%2d", $cache->{$name.':'.$sequence.
-                                            ':problemsCorrect'}, 
+                                            ':problemsCorrect'},
                                             $characterCount);
         if($hasData eq 'true') {
             $Str .= '<font color="#007700">'.$outputProblemsCorrect.'</font>';
@@ -382,6 +468,8 @@
     return $Str;
 }
 
+
+
 =pod
 
 =item &CreateLegend()
@@ -403,7 +491,7 @@
 	      "   #  ungraded attempted\n".
               "      not attempted (blank field)\n".
 	      "   x  excused".
-              "</pre><p>"; 
+              "</pre><p>";
     return $Str;
 }
 
@@ -412,7 +500,7 @@
 =item &CreateColumnSelectionBox()
 
 If there are columns not being displayed then this selection box is created
-with a list of those columns.  When selections are made and the page 
+with a list of those columns.  When selections are made and the page
 refreshed, the columns will be removed from this box and the column is
 put back in the chart.  If there is no columns to select, no row is added
 to the interface table.
@@ -423,13 +511,13 @@
 
 $CacheData: A pointer to a hash tied to the cached data
 
-$headings:  An array of the names of the columns for the student information.  
+$headings:  An array of the names of the columns for the student information.
 They are used for displaying which columns are missing.
 
 Output: $notThere
 
-$notThere: The string contains one row of a table.  The first column has the 
-name of the selection box.  The second contains the selection box 
+$notThere: The string contains one row of a table.  The first column has the
+name of the selection box.  The second contains the selection box
 which has a size of four.
 
 =back
@@ -459,7 +547,7 @@
 
 =item &CreateColumnSelectors()
 
-This function generates the checkboxes above the column headings.  The 
+This function generates the checkboxes above the column headings.  The
 column will be removed if the checkbox is unchecked.
 
 =over 4
@@ -509,7 +597,7 @@
 sub FindSelectedStudent {
     my($cache, $selectedName, $students)=@_;
 
-    if($selectedName eq 'All Students' || 
+    if($selectedName eq 'All Students' ||
        $selectedName eq 'No Student Selected') {
         return $selectedName;
     }

--minaeibi1035493087--