Skip to content

Commit

Permalink
Translate error messages from CreateEvaluationCriterion mutation (pup…
Browse files Browse the repository at this point in the history
…ilfirst#1512)

Co-authored-by: Hari Gopal <[email protected]>
  • Loading branch information
hammaazarok and harigopal authored Dec 6, 2023
1 parent 47c7d77 commit 049922e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/queries/create_evaluation_criterion_mutator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ def unique_name_and_grade_params

errors.add(
:base,
'Criterion already exists with same name, max grade and pass grade'
I18n.t('mutations.evaluation_criterion.name_exists')
)
end

def course_must_be_present
return if course.present?

errors.add(:base, "Course with ID #{course_id} does not exist")
errors.add(:base, I18n.t("mutations.evaluation_criterion.no_course", course_id: course.id))
end

def create_evaluation_criterion
Expand Down
3 changes: 3 additions & 0 deletions config/locales/ar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2277,6 +2277,9 @@ ar:
course_not_found_error: Could not find a course with the given ID
success_notification: Your export is being processed. We'll notify you as soon as it is ready.
tag_not_found_error: Could not find tags with the given IDs
evaluation_criterion:
name_exists: اسم المعيار موجود مسبقاً
no_course: لا توجد دورة تحمل الرقم %{course_id}
initiate_account_deletion:
check_inbox_notification: Check your inbox for further steps!
deletion_init_notification: Account Deletion Initiated
Expand Down
3 changes: 3 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2304,6 +2304,9 @@ en:
course_not_found_error: Could not find a course with the given ID
success_notification: Your export is being processed. We'll notify you as soon as it is ready.
tag_not_found_error: Could not find tags with the given IDs
evaluation_criterion:
name_exists: A criterion already exists with this name and maximum grade.
no_course: Course with ID %{course_id} does not exist; please reload this page before trying again.
initiate_account_deletion:
check_inbox_notification: Check your inbox for further steps!
deletion_init_notification: Account Deletion Initiated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def label_for_grade(grade_labels, grade)
select evaluation_criterion_1.max_grade, from: 'max_grade'

click_button 'Create Criterion'
expect(page).to have_text("Criterion already exists with same name, max grade and pass grade")
expect(page).to have_text("A criterion already exists with this name and maximum grade")
end

scenario 'course author creates and edits a criterion' do
Expand Down

0 comments on commit 049922e

Please sign in to comment.