Skip to content

Commit

Permalink
Completely reset the result
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 29, 2024
1 parent f4fff90 commit e9a0997
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/Cavil/Task/Analyze.pm
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ sub _analyzed ($job, $id) {

# risk 0 is spooky
unless ($risk) {
$pkg->{result} = '';
$pkg->{result} = undef;
$pkg->{notice} = 'Manual review is required because of unusually low risk (0)';
$pkgs->update($pkg);
return;
Expand Down Expand Up @@ -204,7 +204,7 @@ sub _look_for_smallest_delta ($app, $pkg, $allow_accept, $has_human_review) {
$pkg->{state} = 'acceptable';
$pkg->{review_timestamp} = 1;
}
$pkg->{result} = '';
$pkg->{result} = undef;
$pkg->{notice} = "Not found any significant difference against $old->{id}";
$pkg->{notice} .= ', manual review is required because previous reports are missing a reviewing user'
unless $has_human_review;
Expand All @@ -220,13 +220,13 @@ sub _look_for_smallest_delta ($app, $pkg, $allow_accept, $has_human_review) {
}

unless ($best) {
$pkg->{result} = '';
$pkg->{result} = undef;
$pkg->{notice} = 'Manual review is required because no previous reports are available';
$pkgs->update($pkg);
return;
}

$pkgs->update({id => $pkg->{id}, result => '', notice => summary_delta($best, $new_summary)});
$pkgs->update({id => $pkg->{id}, result => undef, notice => summary_delta($best, $new_summary)});
}

1;
2 changes: 1 addition & 1 deletion t/analyze.t
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ subtest 'Analyze background job' => sub {
$t->app->minion->perform_jobs;

my $res = $t->app->pg->db->select('bot_packages', '*', {id => 2})->hashes->[0];
is $res->{result}, '', 'different spec';
is $res->{result}, undef, 'result cleared';
is $res->{notice}, "Diff to closest match 1:\n\n Different spec file license: Artistic-2.0\n\n", 'different spec';
is $res->{state}, 'new', 'not approved';
};
Expand Down

0 comments on commit e9a0997

Please sign in to comment.