Skip to content

Commit

Permalink
298 Fix unauthorized error message
Browse files Browse the repository at this point in the history
  • Loading branch information
cpreisinger committed Jan 10, 2025
1 parent 11d35a1 commit 089d991
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions app/controllers/evaluations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def new
return redirect_to evaluations_path, alert: I18n.t("evaluations.alerts.evaluator_submission_assignment_not_found")
end

phase = @evaluator_submission_assignment.phase
@evaluation_form = EvaluationForm.find_by(phase:)
@evaluation_form = EvaluationForm.find_by(phase: @evaluator_submission_assignment.phase)

if @evaluation_form.nil?
return redirect_to evaluations_path, alert: I18n.t("evaluations.alerts.evaluation_form_not_found")
Expand Down
3 changes: 2 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ en:
alerts:
evaluator_submission_assignment_not_found: "No assignment found for this submission"
evaluation_form_not_found: "No evaluation form found for this submission"
save_draft_error: "Failed to save evaluation as draft: #{errors}."
save_draft_error: "Failed to save evaluation as draft: %{errors}."
mark_complete_error: "Failed to mark evaluation as complete: %{errors}."
unauthorized: "No assignment found for this submission"
notices:
saved_draft: "Evaluation saved as draft"
marked_complete: "Evaluation complete"
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/evaluations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@

expect(response).to render_template(:new)
expect(response).to have_http_status(:unprocessable_entity)
expect(flash[:alert]).to match(I18n.t("evaluations.alerts.save_draft_error"))
expect(flash[:alert]).to match(I18n.t("evaluations.alerts.save_draft_error", errors: evaluation.errors.full_messages.to_sentence))
end
end
end
Expand Down

0 comments on commit 089d991

Please sign in to comment.