Archived
1
0

gen_grades: better resolution of names

This commit is contained in:
Mercier Pierre-Olivier 2013-11-18 22:28:10 +01:00
parent 555c922786
commit f02f484cb8

View File

@ -100,16 +100,14 @@ sub grades_generate
for my $login (@logins)
{
my @files;
log DEBUG, "Generating grades for $login";
for my $dir (@trace_dirs)
{
log DEBUG, "Fetching identifiers from $dir";
my $tr_file = "$year/$project_id/traces/$dir/$login.xml";
# Looking for a group traces?
if (! -f "$basedir/$tr_file")
{
# Looking for a group traces first
for my $grp (@{ $groups->{groups} })
{
my $this = 0;
@ -125,26 +123,30 @@ sub grades_generate
}
if ($this && $chief)
{
$tr_file = "$year/$project_id/traces/$dir/".$chief->{login}.".xml";
log DEBUG, "Using group trace: chief is ".$chief->{login};
if (-f "$basedir/$year/$project_id/traces/$dir/".$chief->{login}.".xml") {
push @files, "$basedir/$year/$project_id/traces/$dir/".$chief->{login}.".xml";
}
last;
}
}
if (-f "$basedir/$year/$project_id/traces/$dir/$login.xml") {
push @files, "$basedir/$year/$project_id/traces/$dir/$login.xml";
}
}
if (-f "$basedir/$tr_file")
for my $path (@files)
{
open my $xmltrace, "<", "$basedir/$tr_file" or die "$tr_file: $!";
open my $xmltrace, "<", "$path" or die "$path: $!";
binmode $xmltrace;
my $trace = Trace->new(join '', <$xmltrace>);
close $xmltrace;
log DEBUG, "Fill from file: $tr_file";
log DEBUG, "Fill from file: $path";
log TRACE, $trace->getIds($login);
$grading->fill($trace->getIds($login));
}
}
log DEBUG, "Computed grades: ".$grading->compute($login);