Grading generation ok
This commit is contained in:
parent
ea7d623eae
commit
80147e449f
1 changed files with 15 additions and 5 deletions
|
@ -5,6 +5,7 @@ use strict;
|
|||
use warnings;
|
||||
use Carp;
|
||||
use Pod::Usage;
|
||||
use Text::ParseWords;
|
||||
|
||||
use lib "../../";
|
||||
|
||||
|
@ -20,10 +21,10 @@ our $basedir = "/intradata";
|
|||
sub process
|
||||
{
|
||||
my $given_args = shift;
|
||||
my @args = shift;
|
||||
my @args = shellwords(${ shift() });
|
||||
|
||||
my $project_id = shift @args;
|
||||
my $year = shift @args // LDAP::get_year();
|
||||
my $year = shift @args // LDAP::get_year;
|
||||
|
||||
# Project existing?
|
||||
if (! -d "$basedir/$year/$project_id")
|
||||
|
@ -38,7 +39,13 @@ sub process
|
|||
opendir(my $dh, "$basedir/$year/$project_id/defenses/") or croak "can't opendir $basedir/$year/$project_id/defenses/: $!";
|
||||
for my $sout (grep { ( ! /^\./ ) && -f "$basedir/$year/$project_id/defenses/$_" } readdir($dh))
|
||||
{
|
||||
my $defense = Defense->new("$basedir/$year/$project_id/defenses/$_");
|
||||
open my $xml, "<", "$basedir/$year/$project_id/defenses/$sout" or die $!;
|
||||
binmode $xml;
|
||||
|
||||
my $str;
|
||||
$str .= $_ while (<$xml>);
|
||||
|
||||
my $defense = Defense->new($str);
|
||||
|
||||
$grade->create_from_ids($sout, $defense->getIds());
|
||||
}
|
||||
|
@ -53,7 +60,10 @@ sub process
|
|||
opendir(my $dhm, "$basedir/$year/$project_id/traces/$dir") or croak "can't opendir $basedir/$year/$project_id/traces/$dir: $!";
|
||||
for my $login (grep { ( ! /^\./ ) && -f "$basedir/$year/$project_id/traces/$dir/$_" } readdir($dhm))
|
||||
{
|
||||
my $trace = Trace->new("$basedir/$year/$project_id/traces/$dir/$_");
|
||||
open my $xml, "<", "$basedir/$year/$project_id/traces/$dir/$login" or die $!;
|
||||
binmode $xml;
|
||||
|
||||
my $trace = Trace->new($xml);
|
||||
|
||||
my %tids = %{ $trace->getIds() };
|
||||
for my $kid (keys %tids)
|
||||
|
@ -62,7 +72,7 @@ sub process
|
|||
}
|
||||
}
|
||||
|
||||
$grade->create_from_ids($_, $ids);
|
||||
$grade->create_from_ids($dir, $ids);
|
||||
}
|
||||
closedir $dh;
|
||||
|
||||
|
|
Reference in a new issue