Commit 231d685a authored by Matthieu Muffato's avatar Matthieu Muffato Committed by ens-bwalts
Browse files

Analysis must have a resource class (because analysis_base.resource_class_id...

Analysis must have a resource class (because analysis_base.resource_class_id is NOT NULL and a foreign key)
parent c346238d
......@@ -797,25 +797,19 @@ sub apply_tweaks {
$tweakStructure->{Action} = TWEAK_ACTION->{substr($operator, 0, 1)};
$tweakStructure->{Return}->{Field} = $attrib_name;
if( $attrib_name eq 'resource_class' ) {
$tweakStructure->{Return}->{OldValue} = $analysis->resource_class ? $analysis->resource_class->name : undef;
$tweakStructure->{Return}->{OldValue} = $analysis->resource_class->name;
if($operator eq '?') {
$tweakStructure->{Return}->{NewValue} = $tweakStructure->{Return}->{OldValue};
if(my $old_value = $analysis->resource_class) {
push @response, "Tweak.Show \tanalysis[$analysis_name].resource_class ::\t".$old_value->name."\n";
} else {
push @response, "Tweak.Show \tanalysis[$analysis_name].resource_class ::\t(missing value)\n";
}
my $old_value = $analysis->resource_class;
push @response, "Tweak.Show \tanalysis[$analysis_name].resource_class ::\t".$old_value->name."\n";
} elsif($operator eq '#') {
$tweakStructure->{Error} = TWEAK_ERROR_MSG->{ACTION_ERROR};
push @response, "Tweak.Error \tDeleting of ResourceClasses is not supported\n";
push @response, "Tweak.Error \tDeleting of an Analysis' resource-class is not supported\n";
} else {
$tweakStructure->{Return}->{NewValue} = $new_value_str;
if(my $old_value = $analysis->resource_class) {
push @response, "Tweak.Changing\tanalysis[$analysis_name].resource_class ::\t".$old_value->name." --> $new_value_str\n";
} else {
push @response, "Tweak.Adding \tanalysis[$analysis_name].resource_class ::\t(missing value) --> $new_value_str\n"; # do we ever NOT have resource_class set?
}
my $old_value = $analysis->resource_class;
push @response, "Tweak.Changing\tanalysis[$analysis_name].resource_class ::\t".$old_value->name." --> $new_value_str\n";
my $resource_class;
if($resource_class = $self->collection_of( 'ResourceClass' )->find_one_by( 'name', $new_value )) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment