Skip to content

Commit

Permalink
hide chart if reports are not from simplecov
Browse files Browse the repository at this point in the history
  • Loading branch information
evsasse committed Dec 23, 2024
1 parent de7201b commit 509f4e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/services/projects/simplecov_progress.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize(project)
def call
# TODO: could be improved to only get the last report of each date.
# TODO: could be improved to remove blank coverage reports at the SQL level.
project.reports.where(branch: "main").order(:created_at).map do |report|
project.reports.simplecov.where(branch: "main").order(:created_at).map do |report|
next if report.general_coverage.blank?

[ report.created_at, report.general_coverage ]
Expand Down
14 changes: 8 additions & 6 deletions app/views/projects/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
<h5>Project</h5>
<h1><%= @project.handle %></h1>

<%=
line_chart(
simplecov_progress,
library: { scales: { y: { type: 'logarithmic' } } }
)
%>
<% if simplecov_progress.present? %>
<%=
line_chart(
simplecov_progress,
library: { scales: { y: { type: 'logarithmic' } } }
)
%>
<% end %>

<div>
<ul class="list-disc">
Expand Down

0 comments on commit 509f4e3

Please sign in to comment.