diff --git a/app/controllers/evaluations_controller.rb b/app/controllers/evaluations_controller.rb index 8eefc220..71cc5253 100644 --- a/app/controllers/evaluations_controller.rb +++ b/app/controllers/evaluations_controller.rb @@ -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") diff --git a/config/locales/en.yml b/config/locales/en.yml index 20fd113c..1728dedc 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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" diff --git a/spec/requests/evaluations_spec.rb b/spec/requests/evaluations_spec.rb index 2592fee2..e68682bf 100644 --- a/spec/requests/evaluations_spec.rb +++ b/spec/requests/evaluations_spec.rb @@ -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