Archived
1
0

Zero values are now treated as valid computation

This commit is contained in:
Mercier Pierre-Olivier 2013-09-21 22:26:39 +02:00
parent 664617171e
commit d709297002
2 changed files with 9 additions and 7 deletions

View File

@ -238,9 +238,10 @@ sub compute ($$$;$$)
$parent->appendChild( $grade );
}
for my $node (@{ $self->{tree} }) {
for my $node (@{ $self->{tree} })
{
my $t = $node->compute($operators, $ids, $doc, $grade);
push @current, $t if $t;
push @current, $t if (defined $t);
}
my $res;
@ -249,11 +250,11 @@ sub compute ($$$;$$)
my $operator = $self->{operator};
my $cpt = new Safe;
$cpt->permit_only(qw(:base_core :base_mem :base_loop padany));
$cpt->permit_only(qw(:base_core :base_mem :base_loop padany rv2gv));
$res = reduce {
$cpt->share('$a');
$cpt->share('$b');
$cpt->reval($operators->{ $operator }) or die "Safe alert: $@";
$cpt->reval($operators->{ $operator }) // die "Safe alert: $@";
}
@current;
}
@ -333,7 +334,7 @@ sub compute ($$$;$$)
my $ids = shift;
my $ret = undef;
if ((not $self->{ref}) || $self->{ref} ~~ $ids) {
if ((not $self->{ref}) || grep { $self->{ref} eq $_ } keys %$ids) {
$ret = $self->getValue( $ids );
}

View File

@ -8,6 +8,7 @@ use File::Basename;
use lib "../../";
use ACU::LDAP;
use ACU::Log;
use ACU::Process;
@ -18,7 +19,7 @@ if ($#ARGV >= 1)
if ($year !~ /^[0-9]{4}$/)
{
unshift $year;
unshift @_, $year;
$year = LDAP::get_year();
}
@ -32,7 +33,7 @@ if ($#ARGV >= 1)
close $input unless $input eq *STDIN;
$file{ basename($f, ".txt", ".lst", ".list", ".xml") } = $cnt;
$files{ basename($f, ".txt", ".lst", ".list", ".xml") } = $cnt;
}
if (my $err = Process::Client::launch("intradata_get", { action => "new_bonus", type => "grades", id => $project_id, "year" => $year }, \%files))