Flowr: Return empty array if no submission was found
This commit is contained in:
@ -6,6 +6,14 @@ class FlowrController < ApplicationController
|
||||
submission = Submission.joins(:testruns)
|
||||
.where(submissions: {user_id: current_user.id, user_type: current_user.class.name})
|
||||
.order('testruns.created_at DESC').first
|
||||
|
||||
# Return if no submission was found
|
||||
if submission.blank?
|
||||
skip_authorization
|
||||
render json: [], status: :ok
|
||||
return
|
||||
end
|
||||
|
||||
# verify authorization for the submission, as all queried errors are generated by this submission anyway
|
||||
# and structured_errors don't have a policy yet
|
||||
authorize(submission)
|
||||
|
Reference in New Issue
Block a user