-
-
Notifications
You must be signed in to change notification settings - Fork 19
Add new quiz set attributes #3047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
795bb8a
feat(Quizzes): Add create quizz set when finish creating quizzes - Ch…
Puppychan 054cc4a
fix(Quiz Sets): Quizzes not displayed in Quiz Sets after finishing cr…
Puppychan 727be5f
fix(Quiz Sets): Quizzes not displayed in Quiz Sets after finishing cr…
Puppychan ae8b50e
feat(quizset): add statistics page for each quiz set
Henry7482 96b89a0
feat (UI - Quizzes); display Quizzes following Quiz-sets, add post me…
Puppychan fc1939d
fix: move mutton for statistics
Henry7482 86c1590
feat(Taking Quiz): add taking page including backend routes, add temp…
Puppychan 08eeb57
refractor(Taking Quiz): Clean files
Puppychan a062cbd
chore: remove unused components
Henry7482 80005e3
fix: temporarily bypass type error by casting workspace_quiz_attempts…
Henry7482 65ba00f
style: apply prettier formatting
Henry7482 7780c76
style: apply prettier formatting for feat/upskii/quiz-set-statistics …
vhpx f9ed408
feat (Taking Quiz); chang ebackend and frontend for more sets attributes
Puppychan 5275499
fix(taking quizz): fix deploy
Puppychan 2de148e
fix<(taking quizz): fix deploy
Puppychan 2db25ca
devs(TakingQuiz); Fix deploy
Puppychan b3ae5e5
devs(TakingQuiz); Fix deploy
Puppychan 06e1d54
style: apply prettier formatting
Puppychan f66ca3f
style: apply prettier formatting for feat/upskii/taking-quiz (#3058)
Puppychan c0fe66c
style: apply prettier formatting
Puppychan a412b36
style: apply prettier formatting for feat/upskii/taking-quiz (#3059)
vhpx 6315b24
style: apply prettier formatting
vhpx aca2927
style: apply prettier formatting for feat/upskii/taking-quiz (#3060)
vhpx e655ec2
Merge branch 'feat/upskii/taking-quiz' into feat/upskii/quiz-set-stat…
Henry7482 84a5711
style: apply prettier formatting
Henry7482 ffeb594
Merge branch 'main' into feat/upskii/taking-quiz
vhpx f845860
chore(db): consolidate migration files
vhpx 447ce10
fix (Taking Quiz): use client misused bug
Puppychan 44831ea
style: apply prettier formatting
vhpx 43edac1
style: apply prettier formatting for feat/upskii/taking-quiz (#3061)
vhpx 678aeec
style: apply prettier formatting for feat/upskii/quiz-set-statistics …
vhpx ea2a4b4
style: apply prettier formatting
vhpx 8d6238d
style: apply prettier formatting for feat/upskii/taking-quiz (#3065)
Puppychan a43abfd
refactor: update TakeQuiz component to use hooks and improve error ha…
vhpx dfedddd
Merge remote-tracking branch 'origin/feat/upskii/taking-quiz' into fe…
vhpx 7bbd5c3
Merge branch 'feat/upskii/taking-quiz' into feat/upskii/quiz-set-stat…
vhpx 01e4449
refactor: remove outdated file references in quiz set routes
vhpx c92c4dd
Merge branch 'feat/upskii/taking-quiz' into feat/upskii/quiz-set-stat…
vhpx 29f86c6
refractor(Taking Quiz): Remove bug formatted comment
Puppychan b48d00b
style: apply prettier formatting
vhpx c05a751
Merge remote-tracking branch 'origin/fix/prettier-formatting-feat/ups…
Puppychan 4351720
Merge branch 'main' into feat/upskii/taking-quiz
Puppychan 30e8ddc
fix (Taking Quiz): fix deploy
Puppychan 61733be
Merge remote-tracking branch 'origin/feat/upskii/taking-quiz' into fe…
Puppychan a977b5b
style: apply prettier formatting
Puppychan ae4a65d
style: apply prettier formatting for feat/upskii/taking-quiz (#3069)
Puppychan dd4a0b0
fix (Taking Quiz): error 404 in all pages
Puppychan 0a15b8a
Merge remote-tracking branch 'origin/feat/upskii/taking-quiz' into fe…
Puppychan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
144 changes: 144 additions & 0 deletions
144
apps/db/supabase/migrations/20250604125645_new_migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
create table "public"."workspace_quiz_attempt_answers" ( | ||
"id" uuid not null default gen_random_uuid(), | ||
"attempt_id" uuid not null, | ||
"quiz_id" uuid not null, | ||
"selected_option_id" uuid not null, | ||
"is_correct" boolean not null, | ||
"score_awarded" real not null | ||
); | ||
|
||
|
||
create table "public"."workspace_quiz_attempts" ( | ||
"id" uuid not null default gen_random_uuid(), | ||
"user_id" uuid not null, | ||
"set_id" uuid not null, | ||
"attempt_number" integer not null, | ||
"started_at" timestamp with time zone not null default now(), | ||
"completed_at" timestamp with time zone, | ||
"total_score" real | ||
); | ||
|
||
|
||
alter table "public"."workspace_quiz_sets" add column "attempt_limit" integer; | ||
|
||
alter table "public"."workspace_quiz_sets" add column "time_limit_minutes" integer; | ||
|
||
alter table "public"."workspace_quizzes" add column "score" integer not null default 1; | ||
|
||
CREATE UNIQUE INDEX workspace_quiz_attempts_pkey ON public.workspace_quiz_attempts USING btree (id); | ||
|
||
CREATE UNIQUE INDEX wq_answer_pkey ON public.workspace_quiz_attempt_answers USING btree (id); | ||
|
||
CREATE UNIQUE INDEX wq_attempts_unique ON public.workspace_quiz_attempts USING btree (user_id, set_id, attempt_number); | ||
|
||
alter table "public"."workspace_quiz_attempt_answers" add constraint "wq_answer_pkey" PRIMARY KEY using index "wq_answer_pkey"; | ||
|
||
alter table "public"."workspace_quiz_attempts" add constraint "workspace_quiz_attempts_pkey" PRIMARY KEY using index "workspace_quiz_attempts_pkey"; | ||
|
||
alter table "public"."workspace_quiz_attempt_answers" add constraint "wq_answer_attempt_fkey" FOREIGN KEY (attempt_id) REFERENCES workspace_quiz_attempts(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; | ||
|
||
alter table "public"."workspace_quiz_attempt_answers" validate constraint "wq_answer_attempt_fkey"; | ||
|
||
alter table "public"."workspace_quiz_attempt_answers" add constraint "wq_answer_option_fkey" FOREIGN KEY (selected_option_id) REFERENCES quiz_options(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; | ||
|
||
alter table "public"."workspace_quiz_attempt_answers" validate constraint "wq_answer_option_fkey"; | ||
|
||
alter table "public"."workspace_quiz_attempt_answers" add constraint "wq_answer_quiz_fkey" FOREIGN KEY (quiz_id) REFERENCES workspace_quizzes(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; | ||
|
||
alter table "public"."workspace_quiz_attempt_answers" validate constraint "wq_answer_quiz_fkey"; | ||
|
||
alter table "public"."workspace_quiz_attempts" add constraint "wq_attempts_set_fkey" FOREIGN KEY (set_id) REFERENCES workspace_quiz_sets(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; | ||
|
||
alter table "public"."workspace_quiz_attempts" validate constraint "wq_attempts_set_fkey"; | ||
|
||
alter table "public"."workspace_quiz_attempts" add constraint "wq_attempts_unique" UNIQUE using index "wq_attempts_unique"; | ||
|
||
alter table "public"."workspace_quiz_attempts" add constraint "wq_attempts_user_fkey" FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; | ||
|
||
alter table "public"."workspace_quiz_attempts" validate constraint "wq_attempts_user_fkey"; | ||
|
||
grant delete on table "public"."workspace_quiz_attempt_answers" to "anon"; | ||
|
||
grant insert on table "public"."workspace_quiz_attempt_answers" to "anon"; | ||
|
||
grant references on table "public"."workspace_quiz_attempt_answers" to "anon"; | ||
|
||
grant select on table "public"."workspace_quiz_attempt_answers" to "anon"; | ||
|
||
grant trigger on table "public"."workspace_quiz_attempt_answers" to "anon"; | ||
|
||
grant truncate on table "public"."workspace_quiz_attempt_answers" to "anon"; | ||
|
||
grant update on table "public"."workspace_quiz_attempt_answers" to "anon"; | ||
|
||
grant delete on table "public"."workspace_quiz_attempt_answers" to "authenticated"; | ||
|
||
grant insert on table "public"."workspace_quiz_attempt_answers" to "authenticated"; | ||
|
||
grant references on table "public"."workspace_quiz_attempt_answers" to "authenticated"; | ||
|
||
grant select on table "public"."workspace_quiz_attempt_answers" to "authenticated"; | ||
|
||
grant trigger on table "public"."workspace_quiz_attempt_answers" to "authenticated"; | ||
|
||
grant truncate on table "public"."workspace_quiz_attempt_answers" to "authenticated"; | ||
|
||
grant update on table "public"."workspace_quiz_attempt_answers" to "authenticated"; | ||
|
||
grant delete on table "public"."workspace_quiz_attempt_answers" to "service_role"; | ||
|
||
grant insert on table "public"."workspace_quiz_attempt_answers" to "service_role"; | ||
|
||
grant references on table "public"."workspace_quiz_attempt_answers" to "service_role"; | ||
|
||
grant select on table "public"."workspace_quiz_attempt_answers" to "service_role"; | ||
|
||
grant trigger on table "public"."workspace_quiz_attempt_answers" to "service_role"; | ||
|
||
grant truncate on table "public"."workspace_quiz_attempt_answers" to "service_role"; | ||
|
||
grant update on table "public"."workspace_quiz_attempt_answers" to "service_role"; | ||
|
||
grant delete on table "public"."workspace_quiz_attempts" to "anon"; | ||
|
||
grant insert on table "public"."workspace_quiz_attempts" to "anon"; | ||
|
||
grant references on table "public"."workspace_quiz_attempts" to "anon"; | ||
|
||
grant select on table "public"."workspace_quiz_attempts" to "anon"; | ||
|
||
grant trigger on table "public"."workspace_quiz_attempts" to "anon"; | ||
|
||
grant truncate on table "public"."workspace_quiz_attempts" to "anon"; | ||
|
||
grant update on table "public"."workspace_quiz_attempts" to "anon"; | ||
|
||
grant delete on table "public"."workspace_quiz_attempts" to "authenticated"; | ||
|
||
grant insert on table "public"."workspace_quiz_attempts" to "authenticated"; | ||
|
||
grant references on table "public"."workspace_quiz_attempts" to "authenticated"; | ||
|
||
grant select on table "public"."workspace_quiz_attempts" to "authenticated"; | ||
|
||
grant trigger on table "public"."workspace_quiz_attempts" to "authenticated"; | ||
|
||
grant truncate on table "public"."workspace_quiz_attempts" to "authenticated"; | ||
|
||
grant update on table "public"."workspace_quiz_attempts" to "authenticated"; | ||
|
||
grant delete on table "public"."workspace_quiz_attempts" to "service_role"; | ||
|
||
grant insert on table "public"."workspace_quiz_attempts" to "service_role"; | ||
|
||
grant references on table "public"."workspace_quiz_attempts" to "service_role"; | ||
|
||
grant select on table "public"."workspace_quiz_attempts" to "service_role"; | ||
|
||
grant trigger on table "public"."workspace_quiz_attempts" to "service_role"; | ||
|
||
grant truncate on table "public"."workspace_quiz_attempts" to "service_role"; | ||
|
||
grant update on table "public"."workspace_quiz_attempts" to "service_role"; | ||
|
||
|
20 changes: 20 additions & 0 deletions
20
apps/db/supabase/migrations/20250605064241_new_migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
alter table "public"."workspace_quiz_sets" add column "allow_view_results" boolean not null default true; | ||
|
||
alter table "public"."workspace_quiz_sets" add column "release_at" timestamp with time zone; | ||
|
||
alter table "public"."workspace_quiz_sets" add column "release_points_immediately" boolean not null default true; | ||
|
||
set check_function_bodies = off; | ||
|
||
CREATE OR REPLACE FUNCTION public.sum_quiz_scores(p_set_id uuid) | ||
RETURNS TABLE(sum numeric) | ||
LANGUAGE sql | ||
AS $function$ | ||
SELECT COALESCE(SUM(wq.score), 0)::numeric | ||
FROM quiz_set_quizzes qsq | ||
JOIN workspace_quizzes wq ON qsq.quiz_id = wq.id | ||
WHERE qsq.set_id = p_set_id; | ||
$function$ | ||
; | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
alter table "public"."workspace_quiz_sets" add column "due_date" timestamp with time zone not null default (now() + '7 days'::interval); | ||
|
||
alter table "public"."workspace_quiz_sets" add column "results_released" boolean not null default false; | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
alter table "public"."workspace_quiz_sets" drop column "release_at"; | ||
|
||
alter table "public"."workspace_quiz_sets" drop column "results_released"; | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.