[LON-CAPA-cvs] cvs: loncom /interface lonnavmaps.pm
foxr
foxr@source.lon-capa.org
Tue, 26 Jan 2010 11:33:48 -0000
foxr Tue Jan 26 11:33:48 2010 EDT
Modified files:
/loncom/interface lonnavmaps.pm
Log:
Add is_incomplete predicate
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.442 loncom/interface/lonnavmaps.pm:1.443
--- loncom/interface/lonnavmaps.pm:1.442 Thu Jan 7 12:42:43 2010
+++ loncom/interface/lonnavmaps.pm Tue Jan 26 11:33:48 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.442 2010/01/07 12:42:43 wenzelju Exp $
+# $Id: lonnavmaps.pm,v 1.443 2010/01/26 11:33:48 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
@@ -478,6 +478,7 @@
use Apache::lonenc();
use Apache::lonlocal;
use Apache::lonnet;
+
use POSIX qw (floor strftime);
use Time::HiRes qw( gettimeofday tv_interval );
use LONCAPA;
@@ -492,7 +493,7 @@
my $resObj = "Apache::lonnavmaps::resource";
-# Keep these mappings in sync with lonquickgrades, which uses the colors
+# Keep these mappings in sync with lonquickgrades, which usesthe colors
# instead of the icons.
my %statusIconMap =
(
@@ -3779,6 +3780,35 @@
}
return 0;
}
+#
+# The has below is the set of status that are considered 'incomplete'
+#
+my %incomplete_hash =
+(
+ TRIES_LEFT() => 1,
+ OPEN() => 1,
+ ATTEMPTED() => 1
+
+ );
+#
+# Return tru if a problem is incomplete... for now incomplete means that
+# any part of the problem is incomplete.
+# Note that if the resources is not a problem, 0 is returned.
+#
+sub is_incomplete {
+ my $self = shift;
+ if ($self->is_problem()) {
+ &Apache::lonnet::logthis('is problem');
+ foreach my $part (@{$self->parts()}) {
+ &Apache::lonnet::logthis("$part status ".$self->status($part));
+ if (exists($incomplete_hash{$self->status($part)})) {
+ return 1;
+ }
+ }
+ }
+ return 0;
+
+}
sub is_raw_problem {
my $self=shift;
my $src = $self->src();