Skip to content

Commit

Permalink
Also show number of manual reviews in stats
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 14, 2024
1 parent 9a0638c commit ba047d7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions assets/vue/CavilStatistics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
<div class="stats-description">Open Reviews</div>
</div>
</div>
<div class="col-md-2">
<div class="stats">
<div class="stats-body">{{ manualReviews }}</div>
<div class="stats-description">Manual Reviews</div>
</div>
</div>
<div class="col-md-2">
<div class="stats">
<div class="stats-body">{{ rejectedPackages }}</div>
Expand All @@ -37,6 +43,7 @@ export default {
return {
activePackages: 0,
embargoedPackages: 0,
manualReviews: 0,
openReviews: 0,
refreshDelay: 120000,
refreshUrl: '/stats/meta',
Expand All @@ -48,6 +55,7 @@ export default {
this.activePackages = data.active_packages;
this.embargoedPackages = data.embargoed_packages;
this.openReviews = data.open_reviews;
this.manualReviews = data.manual_reviews;
this.rejectedPackages = data.rejected_packages;
}
}
Expand Down
3 changes: 2 additions & 1 deletion lib/Cavil/Model/Packages.pm
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,8 @@ sub stats {
(SELECT COUNT(*) FROM bot_packages WHERE obsolete = false) AS active_packages,
(SELECT COUNT(*) FROM bot_packages WHERE obsolete = false AND embargoed = true) AS embargoed_packages,
(SELECT COUNT(*) FROM bot_packages WHERE obsolete = false AND state = 'unacceptable') AS rejected_packages,
(SELECT COUNT(*) FROM bot_packages WHERE obsolete = false AND state = 'new') AS open_reviews"
(SELECT COUNT(*) FROM bot_packages WHERE obsolete = false AND state = 'new') AS open_reviews,
(SELECT COUNT(*) FROM bot_packages WHERE obsolete = false AND reviewing_user IS NOT NULL) AS manual_reviews"
)->hash;

return $stats;
Expand Down
2 changes: 1 addition & 1 deletion t/stats.t
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ subtest 'Statistics' => sub {

$t->get_ok('/stats')->status_is(200)->content_like(qr/id="statistics"/);
$t->get_ok('/stats/meta')->status_is(200)->json_is('/active_packages', 2)->json_is('/embargoed_packages', 0)
->json_is('/open_reviews' => 2)->json_is('/rejected_packages' => 0);
->json_is('/open_reviews' => 2)->json_is('/rejected_packages' => 0)->json_is('/manual_reviews' => 0);

$t->get_ok('/logout')->status_is(302)->header_is(Location => '/');
};
Expand Down

0 comments on commit ba047d7

Please sign in to comment.