[LON-CAPA-cvs] cvs: loncom /interface lonwhatsnew.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Fri, 29 Apr 2005 14:54:19 -0000
raeburn Fri Apr 29 10:54:19 2005 EDT
Modified files:
/loncom/interface lonwhatsnew.pm
Log:
Change separator from _ to \0 - increase possibilities for future use of data in db file, by making more reliably unique split argument. Eliminate $_ to improve readability.
Index: loncom/interface/lonwhatsnew.pm
diff -u loncom/interface/lonwhatsnew.pm:1.11 loncom/interface/lonwhatsnew.pm:1.12
--- loncom/interface/lonwhatsnew.pm:1.11 Mon Apr 18 16:35:07 2005
+++ loncom/interface/lonwhatsnew.pm Fri Apr 29 10:54:18 2005
@@ -1,5 +1,5 @@
#
-# $Id: lonwhatsnew.pm,v 1.11 2005/04/18 20:35:07 raeburn Exp $
+# $Id: lonwhatsnew.pm,v 1.12 2005/04/29 14:54:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -525,20 +525,20 @@
}
# Compile maxtries and degree of difficulty for problem parts
my @parts = @{$resource->parts()};
- my %stats = ();
+ my %stats;
my $warning = 0;
my $rowColor;
- foreach (@parts) {
- %{$stats{$_}} = ();
+ foreach my $part (@parts) {
+ %{$stats{$part}} = ();
my ($attempts,$users,$corrects,$degdiff,$av_attempts);
- if (exists($resourcetracker{$symb.'_'.$_.'_attempts'})) {
- $attempts = $resourcetracker{$symb.'_'.$_.'_attempts'};
+ if (exists($resourcetracker{$symb."\0".$part."\0attempts"})) {
+ $attempts = $resourcetracker{$symb."\0".$part."\0attempts"};
}
- if (exists($resourcetracker{$symb.'_'.$_.'_users'})) {
- $users = $resourcetracker{$symb.'_'.$_.'_users'};
+ if (exists($resourcetracker{$symb."\0".$part."\0users"})) {
+ $users = $resourcetracker{$symb."\0".$part."\0users"};
}
- if (exists($resourcetracker{$symb.'_'.$_.'_correct'})) {
- $corrects = $resourcetracker{$symb.'_'.$_.'_correct'};
+ if (exists($resourcetracker{$symb."\0".$part."\0correct"})) {
+ $corrects = $resourcetracker{$symb."\0".$part."\0correct"};
}
if ($attempts > 0) {
$degdiff = 1 - ($corrects/$attempts);
@@ -548,9 +548,9 @@
$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;
+ $stats{$part}{degdiff} = $degdiff;
+ $stats{$part}{attempts} = $av_attempts;
+ $stats{$part}{users} = $users;
$warning = 1;
}
}
@@ -561,22 +561,22 @@
$rowColor = $rowColor2;
}
$$triggered{$symb}{title} = $resource->title;
- foreach (@parts) {
- if (exists($stats{$_}{users})) {
+ foreach my $part (@parts) {
+ if (exists($stats{$part}{users})) {
if ($$triggered{$symb}{numparts}) {
$$triggered{$symb}{text} .= '<tr bgcolor="'.$rowColor.'">'."\n";
}
if (@parts > 1) {
$$triggered{$symb}{text} .= '
- <td align="right"><small>part - '.$_.'<small></td>';
+ <td align="right"><small>part - '.$part.'<small></td>';
} else {
$$triggered{$symb}{text} .= '
<td align="right"><small>single part</small></td>';
}
$$triggered{$symb}{text} .= '
- <td align="right"><small>'.$stats{$_}{users}.'</small></td>
- <td align="right"><small>'.$stats{$_}{attempts}.'</small></td>
- <td align="right"><small>'.$stats{$_}{degdiff}.'</small></td>
+ <td align="right"><small>'.$stats{$part}{users}.'</small></td>
+ <td align="right"><small>'.$stats{$part}{attempts}.'</small></td>
+ <td align="right"><small>'.$stats{$part}{degdiff}.'</small></td>
</tr>';
$$triggered{$symb}{numparts} ++;
}