From e9a0997b48d81d5855cb5372ff6bce1f19ea247c Mon Sep 17 00:00:00 2001 From: Sebastian Riedel Date: Thu, 29 Aug 2024 16:21:47 +0200 Subject: [PATCH] Completely reset the result --- lib/Cavil/Task/Analyze.pm | 8 ++++---- t/analyze.t | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Cavil/Task/Analyze.pm b/lib/Cavil/Task/Analyze.pm index 58532abb2..e6979749c 100644 --- a/lib/Cavil/Task/Analyze.pm +++ b/lib/Cavil/Task/Analyze.pm @@ -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; @@ -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; @@ -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; diff --git a/t/analyze.t b/t/analyze.t index 42f2c28d6..90ff9679c 100644 --- a/t/analyze.t +++ b/t/analyze.t @@ -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'; };