Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PRT-2182] Fix: prevents reports list to broke with no available report #131

Open
wants to merge 1 commit into
base: master-elos
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ReportsController < ApplicationController
# GET /rooms/:id/reports
def index
respond_to do |format|
@reports = Mconf::DataApi.reports_available(@room.consumer_config.key, @room.handler).reverse()
@reports = Mconf::DataApi.reports_available(@room.consumer_config.key, @room.handler)&.reverse()
format.html { render 'rooms/reports' }
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/mconf/data_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ def self.reports_available(consumer_key, handler)

if response.status == 400
Rails.logger.error "[Data API] Bad request (consumer_key: #{consumer_key} and handler: #{handler})"
return nil
elsif response.status == 404
Rails.logger.error "[Data API] No reports found"
return nil
end

response.body
Expand Down
2 changes: 1 addition & 1 deletion themes/elos/views/shared/_reports.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h2><%= t('reports.title') %></h2>
</div>

<% if reports.count > 0 %>
<% if reports.present? && reports.count > 0 %>
<div class="col-12">
<table id="report-table" class="table">
<tbody>
Expand Down