Archived
1
0

Bonus/malus are now individual by default

This commit is contained in:
Mercier Pierre-Olivier 2014-01-16 23:25:03 +01:00
parent 4877749a76
commit 24df9247e7
2 changed files with 19 additions and 2 deletions

View File

@ -10,6 +10,8 @@ use utf8;
use open qw(:encoding(UTF-8) :std); use open qw(:encoding(UTF-8) :std);
use XML::LibXML; use XML::LibXML;
use ACU::Log;
sub new sub new
{ {
my $class = shift; my $class = shift;
@ -106,6 +108,8 @@ sub addId
my $e = Trace::Eval->new($key); my $e = Trace::Eval->new($key);
$e->addValue(undef, $value); $e->addValue(undef, $value);
push @{ $self->{groups} }, $e; push @{ $self->{groups} }, $e;
return $e;
} }
sub delId sub delId
@ -120,7 +124,7 @@ sub delId
{ {
if (!$value || $value == $group->getValue()) if (!$value || $value == $group->getValue())
{ {
$self->{groups} = \{ grep { $_->{id} ne $key } @{ $self->{groups} } }; $self->{groups} = [ grep { $_->{id} ne $key } @{ $self->{groups} } ];
} }
last; last;
} }
@ -228,6 +232,8 @@ use strict;
use warnings; use warnings;
use Carp; use Carp;
use ACU::Log;
sub new ($$) sub new ($$)
{ {
my $class = shift; my $class = shift;
@ -419,6 +425,16 @@ sub delId
# Do nothing here, just an abstract method # Do nothing here, just an abstract method
} }
sub changeWho
{
my $self = shift;
$self->{who} = {
login => shift,
type => shift // "login"
};
}
sub getIds sub getIds
{ {
my $self = shift; my $self = shift;

View File

@ -235,7 +235,8 @@ sub grades_new_bonus
$trace->delId($kbonus); $trace->delId($kbonus);
} }
} else { } else {
$trace->addId($kbonus, $tvalue); my $e = $trace->addId($kbonus, $tvalue);
$e->changeWho($login, "login");
} }
log DEBUG, "Updating $basedir/$year/$project_id/traces/bonus/$login.xml"; log DEBUG, "Updating $basedir/$year/$project_id/traces/bonus/$login.xml";