Changes between Version 7 and Version 8 of DatabaseProgramming-AdvDb
- Timestamp:
- 06/08/26 08:46:51 (8 days ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DatabaseProgramming-AdvDb
v7 v8 77 77 then ((v_earned_points::numeric / v_total_points) * 100)::int 78 78 else 0 end; 79 79 80 80 v_passed := v_score >= v_passing_score; 81 81 … … 89 89 90 90 insert into quiz_attempt_answer (correct, quiz_question_id, quiz_attempt_id) 91 select qao.correct, 92 (a ->> 'question_id')::bigint, 93 v_attempt_id 91 select 92 -- all correct options were selected AND no incorrect options were selected 93 (count(*) filter (where qao.correct = true) = 94 (select count(*) 95 from quiz_answer_option 96 where quiz_question_id = (a ->> 'question_id')::bigint 97 and correct = true)) 98 and 99 (count(*) filter (where qao.correct = false) = 0), 100 (a ->> 'question_id')::bigint, 101 v_attempt_id 94 102 from jsonb_array_elements(p_answers) a 95 join quiz_answer_option qao on qao.id = (a ->> 'answer_option_id')::bigint; 103 join quiz_answer_option qao on qao.id = (a ->> 'answer_option_id')::bigint 104 group by (a ->> 'question_id'); 96 105 97 106 insert into quiz_attempt_answer_selected_options (quiz_attempt_answer_id, quiz_answer_option_id)
