<aside>

</aside>

Persistence Model

Table quiz_attempts [note: 'Lịch sử từng lần làm quiz'] 
{
  id                uuid                        [pk, note: 'Khóa chính lần làm quiz']  
  user_id           uuid                        [ref: > users.id, note: 'Học viên attempt']  
  lesson_id         uuid                        [ref: > quiz_lessons.lesson_id, note: 'Quiz lesson']  
  score             int                         [not null, note: 'Điểm đạt được']  
  started_at        timestamp                   [note: 'Bắt đầu làm']  
  attempt_at        timestamp                   [note: 'Nộp bài']  
  is_passed         bool                        [note: 'Đạt qua không']  
  passed_at         timestamp                   [note: 'Thời điểm đạt']  
  created_at        timestamp                   [default: `now()`]  
  updated_at        timestamp                   [default: `now()`]  
  deleted_at        timestamp                   [null]
}
Table quiz_attempt_answers [note: 'Câu trả lời chi tiết cho mỗi quiz attempt'] 
{
  id                  uuid                      [pk, note: 'Khóa chính answer record']  
  attempt_id          uuid                      [ref: > quiz_attempts.id, note: 'Lần làm quiz']  
  question_id         uuid                      [ref: > quiz_questions.id, note: 'Câu hỏi trả lời']  
  selected_option_id  uuid                      [ref: > quiz_options.id, note: 'ID đáp án chọn']  
  text_response       text                      [note: 'Nội dung trả lời (short answer)']  
  answer_at           timestamp                 [note: 'Thời điểm trả lời']

  indexes { (attempt_id, question_id, selected_option_id) [unique] } 
}

Domain Use Cases

Start Quiz Attempt Command

Record Quiz Answer Command

List Quiz Answer By Attempt Query

Submit Quiz Attempt Command

(TODO) List Quiz Attempts By Lesson Query

(TODO) Get Quiz Attempt Detail Query

(TODO) Get Quiz Attempt Latest Query


TODO

List Quiz Attempts By User Query