');
+}
+
sub getitems {
- my ($unread,$ungraded,$bombed,$newdiscussions,$tograde,$bombs) = @_;
+ my ($unread,$ungraded,$bombed,$triggered,$newdiscussions,$tograde,$bombs,$warnings,$rowColor1,$rowColor2) = @_;
my $navmap = Apache::lonnavmaps::navmap->new();
my @allres=$navmap->retrieveResources();
my %discussiontime = &Apache::lonnet::dump('discussiontimes',
@@ -383,6 +435,13 @@ sub getitems {
my @discussions = ();
my ($classlist,$keylist) = &Apache::loncoursedata::get_classlist();
+ my %resourcetracker = &Apache::lonnet::dump('nohist_resourcetracker',
+ $env{'course.'.$env{'request.course.id'}.'.domain'},
+ $env{'course.'.$env{'request.course.id'}.'.num'});
+
+ my $diffcheck = 0;
+ my $triescheck = 0;
+ my $warningnum = 0;
foreach my $key (keys(%lastread)) {
my $newkey = $key;
$newkey =~ s/_lastread$//;
@@ -394,11 +453,10 @@ sub getitems {
my $symb = $resource->symb();
%{$$bombed{$symb}} = ();
%{$$ungraded{$symb}} = ();
+ %{$$triggered{$symb}} = ();
+ $$triggered{$symb}{numparts} = 0;
my $title = $resource->compTitle();
- my $ressymb = $symb;
- if ($ressymb =~ m-___adm/\w+/\w+/\d+/bulletinboard$-) {
- $ressymb = $resource->wrap_symb();
- }
+ my $ressymb = $resource->wrap_symb();
# Check for unread discussion postings
if (defined($discussiontime{$ressymb})) {
push(@discussions,$ressymb);
@@ -419,12 +477,12 @@ sub getitems {
if ($prevread <$contrib{$id.':timestamp'}) {
$$unread{$ressymb}{$unreadcount} = $id.': '.$contrib{$id.':subject'};
$unreadcount ++;
- push(@{$newdiscussions}, $ressymb);
}
}
}
}
- }
+ if ($unreadcount) { push(@{$newdiscussions}, $ressymb); }
+ }
# Check for ungraded problems
if ($resource->is_problem()) {
@@ -435,16 +493,16 @@ sub getitems {
my ($uname,$udom) = split(/:/,$student);
my %status=&Apache::grades::student_gradeStatus($url,$symb,$udom,$uname,$partlist);
my $submitted = 0;
- my $graded = 0;
+ my $ungraded = 0;
foreach (keys(%status)) {
$submitted = 1 if ($status{$_} ne 'nothing');
- $graded = 1 if ($status{$_} !~ /^correct/);
+ $ungraded = 1 if ($status{$_} =~ /^ungraded/);
my ($foo,$partid,$foo1) = split(/\./,$_);
if ($status{'resource.'.$partid.'.submitted_by'} ne '') {
$submitted = 0;
}
}
- next if (!$submitted || !$graded);
+ next if (!$submitted || !$ungraded);
$ctr ++;
}
if ($ctr) {
@@ -465,8 +523,68 @@ sub getitems {
$$bombed{$symb}{errorlink} = $errorlink;
push(@{$bombs}, $symb);
}
+# Compile maxtries and degree of difficulty for problem parts
+ my @parts = @{$resource->parts()};
+ my %stats = ();
+ my $warning = 0;
+ my $rowColor;
+ foreach (@parts) {
+ %{$stats{$_}} = ();
+ my ($attempts,$users,$corrects,$degdiff,$av_attempts);
+ if (exists($resourcetracker{$symb.'_'.$_.'_attempts'})) {
+ $attempts = $resourcetracker{$symb.'_'.$_.'_attempts'};
+ }
+ if (exists($resourcetracker{$symb.'_'.$_.'_users'})) {
+ $users = $resourcetracker{$symb.'_'.$_.'_users'};
+ }
+ if (exists($resourcetracker{$symb.'_'.$_.'_correct'})) {
+ $corrects = $resourcetracker{$symb.'_'.$_.'_correct'};
+ }
+ if ($attempts > 0) {
+ $degdiff = 1 - ($corrects/$attempts);
+ $degdiff = sprintf("%.2f",$degdiff);
+ }
+ if ($users > 0) {
+ $av_attempts = $attempts/$users;
+ }
+ if (($degdiff ne '' && $degdiff >= $diffcheck) || ($av_attempts ne '' && $av_attempts >= $triescheck)) {
+ $stats{$_}{degdiff} = $degdiff;
+ $stats{$_}{attempts} = $av_attempts;
+ $stats{$_}{users} = $users;
+ $warning = 1;
+ }
+ }
+ if ($warning) {
+ if ($warningnum %2 == 1) {
+ $rowColor = $rowColor1;
+ } else {
+ $rowColor = $rowColor2;
+ }
+ $$triggered{$symb}{title} = $resource->title;
+ foreach (@parts) {
+ if (exists($stats{$_}{users})) {
+ if ($$triggered{$symb}{numparts}) {
+ $$triggered{$symb}{text} .= ' |