This is implement in an extremely hacky way due to poor DBIx feature support. Ideally, what we'd need is a way to tell DBIx to ignore the errormsg column unless explicitly requested, and to automatically add a computed 'errormsg IS NULL' column in others. Since it does not support that, this commit instead hacks some support via method overrides while taking care to not break anything obvious.
31 lines
758 B
Perl
31 lines
758 B
Perl
package Hydra::Schema::ResultSet::Jobsets;
|
|
|
|
use strict;
|
|
use utf8;
|
|
use warnings;
|
|
|
|
use parent 'DBIx::Class::ResultSet';
|
|
|
|
use Storable qw(dclone);
|
|
|
|
__PACKAGE__->load_components('Helper::ResultSet::RemoveColumns');
|
|
|
|
# Exclude expensive error message values unless explicitly requested, and
|
|
# replace them with a summary field describing their presence/absence.
|
|
sub search_rs {
|
|
my ( $class, $query, $attrs ) = @_;
|
|
|
|
if ($attrs) {
|
|
$attrs = dclone($attrs);
|
|
}
|
|
|
|
unless (exists $attrs->{'select'} || exists $attrs->{'columns'}) {
|
|
$attrs->{'+columns'}->{'has_error'} = "errormsg != ''";
|
|
}
|
|
unless (exists $attrs->{'+columns'}->{'errormsg'}) {
|
|
push @{ $attrs->{'remove_columns'} }, 'errormsg';
|
|
}
|
|
|
|
return $class->next::method($query, $attrs);
|
|
}
|