Skip to content

Commit

Permalink
Report the right status report
Browse files Browse the repository at this point in the history
:report_uuid is mandatory but wasn't used in the controller. Instead
it always returned .first - for unknown reason

Fixes #6124
  • Loading branch information
coolo committed Dec 17, 2018
1 parent 9559d3d commit c7a98b6
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/api/app/controllers/status/reports_controller.rb
Expand Up @@ -13,14 +13,11 @@ def show
private

def set_status_report
@status_report = @checkable.status_reports.first
@status_report = @checkable.status_reports.find_by(uuid: params[:uuid]) if params[:uuid]
return if @status_report

render_error(
status: 404,
errorcode: 'not_found',
message: 'Status report not found.'
)
if params[:report_uuid]
@status_report = @checkable.status_reports.find_by!(uuid: params[:report_uuid])
else
# request reports don't have uuid
@status_report = @checkable.status_reports.first
end
end
end

0 comments on commit c7a98b6

Please sign in to comment.