[LON-CAPA-cvs] cvs: loncom /interface lonhtmlcommon.pm /interface/statistics lonstudentassessment.pm
bisitz
bisitz@source.lon-capa.org
Wed, 09 Jun 2010 14:55:27 -0000
bisitz Wed Jun 9 14:55:27 2010 EDT
Modified files:
/loncom/interface lonhtmlcommon.pm
/loncom/interface/statistics lonstudentassessment.pm
Log:
Status Bar:
Introduce optional parameter for lonhtmlcommon::Increment_PrgWin() to allow other counter steps than 1 (solves side effects of bug 6022 resolution).
Default is 1.
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.274 loncom/interface/lonhtmlcommon.pm:1.275
--- loncom/interface/lonhtmlcommon.pm:1.274 Wed Jun 2 05:34:27 2010
+++ loncom/interface/lonhtmlcommon.pm Wed Jun 9 14:55:22 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.274 2010/06/02 05:34:27 droeschl Exp $
+# $Id: lonhtmlcommon.pm,v 1.275 2010/06/09 14:55:22 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1049,11 +1049,22 @@
# increment progress state
sub Increment_PrgWin {
- my ($r,$prog_state,$extraInfo)=@_;
- $$prog_state{'done'}++;
+ my ($r,$prog_state,$extraInfo,$step)=@_;
+ if ($step !~ /^\d+$/) {
+ $step = 1; # default
+ }
+ $$prog_state{'done'} += $step;
+
+ # Catch (max modulo step) <> 0
+ my $current = $$prog_state{'done'};
+ my $last = ($$prog_state{'max'} - $current);
+ if ($last <= 0) {
+ $last = 1;
+ $current = $$prog_state{'max'};
+ }
+
my $time_est= (&Time::HiRes::time() - $$prog_state{'firststart'})/
- $$prog_state{'done'} *
- ($$prog_state{'max'}-$$prog_state{'done'});
+ $current * $last;
$time_est = int($time_est);
#
my $min = int($time_est/60);
@@ -1100,7 +1111,7 @@
$$prog_state{'window'}.'.document.'.
$$prog_state{'formname'}.'.'.
$$prog_state{'inputname'}.'.value="'.
- $$prog_state{'done'}.'/'.$$prog_state{'max'}.
+ $current.'/'.$$prog_state{'max'}.
': '.$time_est.' '.&mt('remaining').' '.$lasttime.'";'
));
$$prog_state{'laststart'}=&Time::HiRes::time();
Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.161 loncom/interface/statistics/lonstudentassessment.pm:1.162
--- loncom/interface/statistics/lonstudentassessment.pm:1.161 Wed Apr 14 06:57:17 2010
+++ loncom/interface/statistics/lonstudentassessment.pm Wed Jun 9 14:55:27 2010
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonstudentassessment.pm,v 1.161 2010/04/14 06:57:17 raeburn Exp $
+# $Id: lonstudentassessment.pm,v 1.162 2010/06/09 14:55:27 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -829,7 +829,7 @@
# $r->print("</pre><pre>");
$r->print('</pre>');
&Apache::lonhtmlcommon::Increment_PrgWin(
- $r,\%prog_state,'last five students');
+ $r,\%prog_state,'last five students',5);
$r->rflush();
$r->print('<pre>');
}