Archived
1
0
Fork 0

Fix grading generation from defenses

This commit is contained in:
Mercier Pierre-Olivier 2013-09-22 15:10:32 +02:00
commit 59aff8677a
5 changed files with 36 additions and 28 deletions

View file

@ -79,7 +79,7 @@ sub add_grades($;$)
);
$data{year} = $_ if (shift);
my $res = API::Base::get('ResultHandler', "projects/groups/generate.xml");
my $res = API::Base::send('ResultHandler', "projects/notes/add.xml", \%data);
if ($res->{result} ne '0') {
croak "Erreur durant l'ajout : " . $res->{message};

View file

@ -116,12 +116,12 @@ sub getIds ($)
for my $answer (@{ $question->{answers} })
{
$ids{ $answer->{id} } = $answer->{value} if ($answer->{id});
$ids{ $answer->{id} } = $answer->{value} // 0 if ($answer->{id});
}
}
}
return %ids;
return \%ids;
}
sub genIds ($)
@ -216,9 +216,12 @@ sub parseQuestions($@)
for my $question (@_)
{
my $expl;
$expl = @{ $question->getElementsByTagName("explanation") }[0]->textContent if $question->getElementsByTagName("explanation");
my $q = Defense::Question->new(
@{ $question->getElementsByTagName("ask") }[0]->textContent,
@{ $question->getElementsByTagName("explanation") }[0]->textContent // "",
$expl // "",
$question->getAttribute("id"),
$question->getAttribute("title"),
$question->getAttribute("type"),

View file

@ -44,9 +44,11 @@ sub create_from_trace ($$)
my $g = Grade->new($trace_id, $trace_name);
for my $id (sort( keys %{ $trace->{ids} } ))
my $ids = $trace->getIds();
for my $id (sort( keys %{ $ids } ))
{
my $p = Point->new($trace->{ids}{$id}, $id, 0, 0);
my $p = Point->new($ids->{$id}, $id, 0, 0);
push @{ $g->{tree} }, $p;
}
@ -117,7 +119,7 @@ sub fill ($$)
}
}
sub to_string ($)
sub toString ($)
{
my $self = shift;
@ -133,7 +135,7 @@ sub to_string ($)
}
for my $grade (@{ $self->{tree} }) {
$grade->to_string($doc, $root, $root);
$grade->toString($doc, $root, $root);
}
$doc->setDocumentElement( $root );
@ -195,7 +197,7 @@ sub new ($$$;$$)
return bless $self;
}
sub to_string ($$$)
sub toString ($$$)
{
my $self = shift;
my $doc = shift;
@ -209,7 +211,7 @@ sub to_string ($$$)
$parent->appendChild($grade);
for my $item (@{ $self->{tree} }) {
$item->to_string($doc, $grade);
$item->toString($doc, $grade);
}
}
@ -296,7 +298,7 @@ sub new ($$$$$)
return bless $self;
}
sub to_string ($$$)
sub toString ($$$)
{
my $self = shift;
my $doc = shift;