Skip to content

Commit

Permalink
Merge pull request #4574 from okurz/fix/cant_call_id_on_undefined_poo…
Browse files Browse the repository at this point in the history
…108662

Prevent error about undefined value in next_previous route
  • Loading branch information
mergify[bot] committed Mar 22, 2022
2 parents 8e63f78 + 7697ecd commit 6f3cb49
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/OpenQA/WebAPI/Controller/Test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -394,15 +394,15 @@ sub infopanel {
$self->render('test/infopanel');
}

sub get_current_job ($self, $with_assets = 0) {
sub _get_current_job ($self, $with_assets = 0) {
return $self->reply->not_found unless defined $self->param('testid');

my $job = $self->schema->resultset("Jobs")
->find($self->param('testid'), {$with_assets ? (prefetch => qw(jobs_assets)) : ()});
return $job;
}

sub show ($self) { $self->_show($self->get_current_job(1)) }
sub show ($self) { $self->_show($self->_get_current_job(1)) }

sub _show {
my ($self, $job) = @_;
Expand All @@ -428,7 +428,7 @@ sub _show {
}

sub job_next_previous_ajax ($self) {
my $main_job = $self->get_current_job;
return $self->reply->not_found unless my $main_job = $self->_get_current_job;
my $main_jobid = $main_job->id;
my $p_limit = $self->param('previous_limit') // 400;
my $n_limit = $self->param('next_limit') // 100;
Expand Down Expand Up @@ -892,7 +892,7 @@ sub _add_job ($dependency_data, $job, $as_child_of, $preferred_depth) {
sub dependencies ($self) {

# build dependency graph starting from the current job
my $job = $self->get_current_job or return $self->reply->not_found;
my $job = $self->_get_current_job or return $self->reply->not_found;
my (@nodes, @edges, %cluster);
my %data = (visited => {}, nodes => \@nodes, edges => \@edges, cluster => \%cluster, cluster_by_job => {});
_add_job(\%data, $job, 0, $job->ancestors);
Expand All @@ -901,7 +901,7 @@ sub dependencies ($self) {

sub investigate {
my ($self) = @_;
return $self->reply->not_found unless my $job = $self->get_current_job;
return $self->reply->not_found unless my $job = $self->_get_current_job;
my $investigation = $job->investigate;
$self->render(json => $investigation);
}
Expand Down

0 comments on commit 6f3cb49

Please sign in to comment.