--- loncom/interface/lonwhatsnew.pm 2005/07/14 21:30:25 1.24 +++ loncom/interface/lonwhatsnew.pm 2005/10/10 13:36:35 1.32 @@ -1,5 +1,5 @@ # -# $Id: lonwhatsnew.pm,v 1.24 2005/07/14 21:30:25 albertel Exp $ +# $Id: lonwhatsnew.pm,v 1.32 2005/10/10 13:36:35 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -208,6 +208,7 @@ sub display_actions_box() { if ($result) { $r->print($result.'
'); } + $r->rflush(); &get_curr_thresholds(\%threshold,$cdom,$crs); &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\@newdiscussions,\@tograde,\@bombs,\@warnings,$rowColor1,$rowColor2,\%threshold,$cdom,$crs,%res_title); @@ -389,7 +390,7 @@ END } else { $rowColor = $rowColor2; } - $r->print(''.$mailcount.'.  '.$msg->{'shortsub'}.'    '.$msg->{'from'}.'@'.$msg->{'fromdom'}.' '.$msg->{'sendtime'}.''); + $r->print(''.$mailcount.'.  '.$msg->{'shortsub'}.'    '.$msg->{'from'}.'@'.$msg->{'fromdom'}.' '.$msg->{'sendtime'}.''); $rowNum ++; $mailcount ++; } @@ -421,7 +422,7 @@ END } else { $rowColor = $rowColor2; } - $r->print(''.$mailcount.'.  '.$msg->{'shortsub'}.'    '.$msg->{'from'}.'@'.$msg->{'fromdom'}.' '.$msg->{'sendtime'}.''); + $r->print(''.$mailcount.'.  '.$msg->{'shortsub'}.'    '.$msg->{'from'}.'@'.$msg->{'fromdom'}.' '.$msg->{'sendtime'}.''); $rowNum ++; $mailcount ++; } @@ -507,7 +508,8 @@ sub display_config_box() { sub getitems { my ($unread,$ungraded,$bombed,$triggered,$newdiscussions,$tograde,$bombs,$warnings,$rowColor1,$rowColor2,$threshold,$cdom,$crs,$res_title) = @_; my $navmap = Apache::lonnavmaps::navmap->new(); - my @allres=$navmap->retrieveResources(); + # force retrieve Resource to seed the part id cache we'll need it later + my @allres=$navmap->retrieveResources(undef,sub {if ($_[0]->is_problem) { $_[0]->parts();} return 1;}); my %discussiontime = &Apache::lonnet::dump('discussiontimes',$cdom,$crs); my %lastread = &Apache::lonnet::dump('nohist_'.$env{'request.course.id'}. '_discuss',$env{'user.domain'},$env{'user.name'},'lastread'); @@ -564,11 +566,12 @@ sub getitems { if ($resource->is_problem()) { my $ctr = 0; my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); - my ($partlist,$handgrade,$responseType) = - &Apache::grades::response_type($url,$symb); + my $partlist=$resource->parts(); my $handgradeable; - foreach my $value (values(%{$handgrade})) { - if ($value eq 'yes') { $handgradeable=1; last; } + foreach my $part (@$partlist) { + if ($resource->handgrade($part) eq 'yes') { + $handgradeable=1; last; + } } if ($handgradeable) { foreach my $student (keys(%$classlist)) { @@ -608,13 +611,16 @@ sub getitems { $$bombed{$symb}{errorlink} = $errorlink; push(@{$bombs}, $symb); } -# Compile maxtries and degree of difficulty for problem parts +# Compile maxtries and degree of difficulty for problem parts, unless handgradeable my @parts = @{$resource->parts()}; my %stats; my %lastreset = (); my $warning = 0; my $rowColor; foreach my $part (@parts) { + if ($resource->handgrade($part) eq 'yes') { + next; + } %{$stats{$part}} = (); my ($attempts,$users,$corrects,$degdiff,$av_attempts); if (exists($resourcetracker{$symb."\0".$part."\0attempts"})) { @@ -639,6 +645,9 @@ sub getitems { $stats{$part}{attempts} = $av_attempts; $stats{$part}{users} = $users; $lastreset{$part} = $resourcetracker{$symb."\0".$part."\0resettime"}; + if ($lastreset{$part}) { + $lastreset{$part} = &Apache::lonnavmaps::timeToHumanString($lastreset{$part}); + } $warning = 1; } }