| 1 | ################################################################################ |
1 | ################################################################################ |
| 2 | # WeBWorK Online Homework Delivery System |
2 | # WeBWorK Online Homework Delivery System |
| 3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
| 4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Grades.pm,v 1.7 2004/10/04 20:56:00 toenail Exp $ |
4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Grades.pm,v 1.8 2004/10/09 03:05:13 gage Exp $ |
| 5 | # |
5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify it under |
6 | # This program is free software; you can redistribute it and/or modify it under |
| 7 | # the terms of either: (a) the GNU General Public License as published by the |
7 | # the terms of either: (a) the GNU General Public License as published by the |
| 8 | # Free Software Foundation; either version 2, or (at your option) any later |
8 | # Free Software Foundation; either version 2, or (at your option) any later |
| 9 | # version, or (b) the "Artistic License" which comes with this package. |
9 | # version, or (b) the "Artistic License" which comes with this package. |
| … | |
… | |
| 305 | |
305 | |
| 306 | my $avg_num_attempts = ($num_of_problems) ? $num_of_attempts/$num_of_problems : 0; |
306 | my $avg_num_attempts = ($num_of_problems) ? $num_of_attempts/$num_of_problems : 0; |
| 307 | my $successIndicator = ($avg_num_attempts) ? ($totalRight/$total)**2/$avg_num_attempts : 0 ; |
307 | my $successIndicator = ($avg_num_attempts) ? ($totalRight/$total)**2/$avg_num_attempts : 0 ; |
| 308 | |
308 | |
| 309 | push @rows, CGI::Tr( |
309 | push @rows, CGI::Tr( |
| 310 | CGI::td(CGI::a({-href=>$act_as_student_set_url},$setName)), |
310 | CGI::td(CGI::a({-href=>$act_as_student_set_url}, underscore2nbsp($setName))), |
| 311 | CGI::td(sprintf("%0.2f",$totalRight)), # score |
311 | CGI::td(sprintf("%0.2f",$totalRight)), # score |
| 312 | CGI::td($total), # out of |
312 | CGI::td($total), # out of |
| 313 | CGI::td(sprintf("%0.0f",100*$successIndicator)), # indicator |
313 | CGI::td(sprintf("%0.0f",100*$successIndicator)), # indicator |
| 314 | CGI::td("<pre>$string\n$twoString</pre>"), # problems |
314 | CGI::td("<pre>$string\n$twoString</pre>"), # problems |
| 315 | #CGI::td($studentRecord->section), |
315 | #CGI::td($studentRecord->section), |
| … | |
… | |
| 349 | |
349 | |
| 350 | ################################# |
350 | ################################# |
| 351 | # Utility function NOT a method |
351 | # Utility function NOT a method |
| 352 | ################################# |
352 | ################################# |
| 353 | sub threeSpaceFill { |
353 | sub threeSpaceFill { |
| 354 | my $num = shift @_ || 0; |
354 | my $num = shift @_ || 0; |
| 355 | |
355 | |
| 356 | if (length($num)<=1) {return "$num".' ';} |
356 | if (length($num)<=1) {return "$num".' ';} |
| 357 | elsif (length($num)==2) {return "$num".' ';} |
357 | elsif (length($num)==2) {return "$num".' ';} |
| 358 | else {return "## ";} |
358 | else {return "## ";} |
| 359 | } |
359 | } |
| 360 | sub round_score{ |
360 | sub round_score{ |
| 361 | return shift; |
361 | return shift; |
| 362 | } |
362 | } |
|
|
363 | |
|
|
364 | sub underscore2nbsp { |
|
|
365 | my $str = shift; |
|
|
366 | $str =~ s/_/ /g; |
|
|
367 | return($str); |
|
|
368 | } |
|
|
369 | |
| 363 | 1; |
370 | 1; |