Fix grading condition resolving
This commit is contained in:
parent
9c1c537e3c
commit
237cafc34e
1 changed files with 19 additions and 25 deletions
|
|
@ -312,21 +312,16 @@ sub toString ($$$)
|
||||||
$parent->appendChild($point);
|
$parent->appendChild($point);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getValue ($$;$)
|
sub getValue ($$)
|
||||||
{
|
{
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $ids = shift;
|
my $ids = shift;
|
||||||
my $justMatch = shift;
|
|
||||||
|
|
||||||
if ($self->{ref} && !$justMatch && !$ids->{ $self->{ref} } // 0) {
|
# Return the point node value if exists
|
||||||
return 0;
|
return $self->{value} if ($self->{value} ne "");
|
||||||
}
|
|
||||||
elsif ($self->{value} eq "") {
|
# Else return pointed ref value
|
||||||
return $ids->{ $self->{ref} } // 0;
|
return $ids->{ $self->{ref} };
|
||||||
}
|
|
||||||
else {
|
|
||||||
return $self->{value};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub compute ($$$;$$)
|
sub compute ($$$;$$)
|
||||||
|
|
@ -336,23 +331,23 @@ sub compute ($$$;$$)
|
||||||
my $ids = shift;
|
my $ids = shift;
|
||||||
my $ret = undef;
|
my $ret = undef;
|
||||||
|
|
||||||
if ((not $self->{ref}) || grep { $self->{ref} eq $_ } keys %$ids) {
|
my $result = (
|
||||||
$ret = $self->getValue( $ids );
|
# No condition on refs nor qversion?
|
||||||
}
|
not $self->{ref}
|
||||||
|
# Condition on refs
|
||||||
|
|| grep { $self->{ref} eq $_ } keys %$ids
|
||||||
|
);
|
||||||
|
|
||||||
if ($self->{not})
|
# Handel not
|
||||||
{
|
$result = !$result if ($self->{not});
|
||||||
if ($ret) {
|
|
||||||
$ret = undef;
|
# ret is valued only if all conditions passed
|
||||||
} else {
|
$ret = $self->getValue( $ids ) if ($result);
|
||||||
$ret = $self->getValue( $ids );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($main::debug)
|
if ($main::debug)
|
||||||
{
|
{
|
||||||
my $str = "not=".($self->{not}//0).", qversion".($self->{qversion}//"*").", ref=".($self->{ref}//"").",\tvalue=".$self->getValue( $ids, 1 ).", got=".($ret // 0);
|
my $str = "not=".($self->{not}//0).", qversion".($self->{qversion}//"*").", ref=".($self->{ref}//"").",\tvalue=".($ids->{ $self->{ref}//"" } // "undef").", got=".($ret // 0);
|
||||||
if ($ret) {
|
if ($result) {
|
||||||
say GREEN, ">>>", RESET, " Matching point: ", $str;
|
say GREEN, ">>>", RESET, " Matching point: ", $str;
|
||||||
} else {
|
} else {
|
||||||
say RED, " * ", RESET, " Skipped point: ", $str;
|
say RED, " * ", RESET, " Skipped point: ", $str;
|
||||||
|
|
@ -362,5 +357,4 @@ sub compute ($$$;$$)
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
Reference in a new issue