reports: fix error when report is empty.
Fix an exception when a report is empty, for example when performing a tag search that returns no results: * https://betabooru.donmai.us/reports/posts?search[group]=uploader&search[tags]=does_not_exist
This commit is contained in:
@@ -18,7 +18,7 @@ class TimeSeriesComponent < ApplicationComponent
|
||||
|
||||
def chart_height
|
||||
if x_axis != "date"
|
||||
dataframe[x_axis].size * 30
|
||||
dataframe[x_axis]&.size.to_i * 30
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if mode == :chart && x_axis.present? %>
|
||||
<% if dataframe.empty? %>
|
||||
<p>No results found. Try modifying your search or expanding your time range.</p>
|
||||
<% elsif mode == :chart && x_axis.present? %>
|
||||
<div class="line-chart" style="width: 100%; height: max(90vh, <%= chart_height.to_i %>px);"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
Reference in New Issue
Block a user