From c75942f3238add6b50c74a1b2cffc1e0cd39138f Mon Sep 17 00:00:00 2001 From: Henrik Nygren Date: Thu, 5 Sep 2024 19:18:12 +0300 Subject: [PATCH] Add indices (#1308) * Add indices * System test fixes --- .../20240905095603_add_indices.down.sql | 20 ++++++++++++++++ .../20240905095603_add_indices.up.sql | 24 +++++++++++++++++++ .../clickable-multiple-choice.spec.ts | 2 +- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 services/headless-lms/migrations/20240905095603_add_indices.down.sql create mode 100644 services/headless-lms/migrations/20240905095603_add_indices.up.sql diff --git a/services/headless-lms/migrations/20240905095603_add_indices.down.sql b/services/headless-lms/migrations/20240905095603_add_indices.down.sql new file mode 100644 index 000000000000..77f21b74b7bf --- /dev/null +++ b/services/headless-lms/migrations/20240905095603_add_indices.down.sql @@ -0,0 +1,20 @@ +DROP INDEX peer_review_queue_entries_exercise_id_created_at_idx; +DROP INDEX roles_user_id_idx; +DROP INDEX course_module_completions_user_id_idx; +DROP INDEX exercise_tasks_exercise_slide_id_idx; +DROP INDEX peer_or_self_review_submission_exercise_slide_submission_id_idx; +DROP INDEX pages_chapter_id_idx; +DROP INDEX pages_page_language_group_id_idx; +DROP INDEX material_references_course_id_idx; +DROP INDEX pages_url_path_idx; +DROP INDEX pages_course_id_idx; +DROP INDEX exercise_task_regrading_submissions_regrading_id_idx; +DROP INDEX peer_review_queue_entries_receiving_peer_reviews_exercise_s_idx; +DROP INDEX exercises_chapter_id_idx; +DROP INDEX exercise_slide_submissions_user_id_exercise_slide_id_idx; +DROP INDEX peer_review_queue_entries_exercise_id_idx; +DROP INDEX users_upstream_id_idx; +DROP INDEX user_exercise_slide_states_user_exercise_state_id_idx; +DROP INDEX teacher_grading_decisions_user_exercise_state_id_idx; +DROP INDEX user_exercise_states_course_instance_id_idx; +DROP INDEX course_specific_consent_form_answers_user_id_idx; diff --git a/services/headless-lms/migrations/20240905095603_add_indices.up.sql b/services/headless-lms/migrations/20240905095603_add_indices.up.sql new file mode 100644 index 000000000000..92294ef69c90 --- /dev/null +++ b/services/headless-lms/migrations/20240905095603_add_indices.up.sql @@ -0,0 +1,24 @@ +CREATE INDEX ON peer_review_queue_entries (exercise_id, created_at); +CREATE INDEX ON roles (user_id); +CREATE INDEX ON course_module_completions (user_id); +CREATE INDEX ON exercise_tasks (exercise_slide_id); +CREATE INDEX ON peer_or_self_review_submissions (exercise_slide_submission_id); +CREATE INDEX ON pages (chapter_id); +CREATE INDEX ON pages (page_language_group_id); +CREATE INDEX ON material_references (course_id); +CREATE INDEX ON pages (url_path); +CREATE INDEX ON pages (course_id); +CREATE INDEX ON exercise_task_regrading_submissions (regrading_id); +CREATE INDEX ON pages (course_id); +CREATE INDEX ON peer_review_queue_entries ( + receiving_peer_reviews_exercise_slide_submission_id +); +CREATE INDEX ON exercises (chapter_id); +CREATE INDEX ON exercise_slide_submissions (user_id, exercise_slide_id); +CREATE INDEX ON peer_review_queue_entries (exercise_id); +CREATE INDEX ON users (upstream_id); +CREATE INDEX ON user_exercise_slide_states (user_exercise_state_id); +CREATE INDEX ON exercise_tasks (exercise_slide_id); +CREATE INDEX ON teacher_grading_decisions (user_exercise_state_id); +CREATE INDEX ON user_exercise_states (course_instance_id); +CREATE INDEX ON course_specific_consent_form_answers (user_id); diff --git a/system-tests/src/tests/quizzes/feedback/clickable-multiple-choice.spec.ts b/system-tests/src/tests/quizzes/feedback/clickable-multiple-choice.spec.ts index bd23d89f897a..3547e4220cfe 100644 --- a/system-tests/src/tests/quizzes/feedback/clickable-multiple-choice.spec.ts +++ b/system-tests/src/tests/quizzes/feedback/clickable-multiple-choice.spec.ts @@ -40,7 +40,7 @@ test.describe(() => { await frame.getByText("Pick all the programming languages from below").waitFor() // eslint-disable-next-line playwright/no-conditional-in-test - if (testInfo.retry && (await page.getByText("Try again").isVisible())) { + if (testInfo.retry) { await page.getByText("Try again").click() await page.getByText("Try again").waitFor({ state: "hidden" }) await frame.getByText("Pick all the programming languages from below").waitFor()