Skip to content
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

Create a Quiz relating models #36

Closed
yunho7687 opened this issue Dec 14, 2024 · 2 comments
Closed

Create a Quiz relating models #36

yunho7687 opened this issue Dec 14, 2024 · 2 comments
Assignees
Labels
backend Task must have a back end issue database model database

Comments

@yunho7687
Copy link
Member

Basic Information

need to create models relating to Quiz
follow the DBML below to create relating models about quiz

Other Information

Table Quiz{
  note: '''
    The settings for each quiz
  '''
id int [pk]
name varchar[255] [note:"Quiz name.", not null]
intro longtext [default: null, note:'Quiz introduction text.']
timeopen timestamp [default: 0]
timeclose timestamp [default: 0]
timelimit timestamp [default: 0]
grade decimal
is_comp bool [note: "check if this quiz is a competition", default: False]
visible bool [default: false]
}

table Quiz_slots{
  id int [pk]
  quiz int [ref: > Quiz.id]
  slot int [increment, note:'can set as `index`'] 
  status enum [note: 'PROCESSING, SUBMITTED']
  questionid int [ref: > Question.id]
  block int 
  display_number varchar [default: null, note:'''Stores customised question number such as 1.2, A1, B12. If this is null, the default number is used.''']
  require_previous bool [default: False]
}
Table Quiz_attempts {
    id bigint [pk] // Primary Key
    quiz bigint [ref: > Quiz.id]
    attempt mediumint [note : "Sequentially numbers this student's attempts at this quiz."]
    question_attempts bigint
    currentpage bigint
    state varchar(16)
    timestart timestamp
    timefinish timestamp
    time_modified timestamp
    time_modified_offline timestamp
    // timecheckstate bigint
    sum_grades decimal(10,5) [note:'Total marks for this attempt.']
    // gradednotificationsenttime bigint
}
Table Quiz_attempt_user {
    id BIGINT [note: 'Primary key, unique identifier for each grade entry.']
    quiz_attempt BIGINT [not null, default: 0, note: 'Foreign key references quiz.id. Represents the quiz associated with this grade.']
    student BIGINT [not null, default: 0, note: 'Foreign key references user.id. Represents the user associated with this grade.']
    grade DECIMAL(10,5) [not null, default: 0.0, note: 'The overall grade from the quiz. Not affected by overrides in the gradebook.']
    time_modified BIGINT [not null, default: 0, note: 'The last time this grade was modified.']
}
Ref: Quiz_attempts.id < Quiz_attempt_user.quiz_attempt [note: 'Defines the foreign key relationship between quiz_grades.quiz and quiz.id.']
Ref: Student.user_id < Quiz_attempt_user.student [note: 'Defines the foreign key relationship between quiz_grades.userid and user.id.']


@yunho7687 yunho7687 added backend Task must have a back end issue database database model labels Dec 14, 2024
@yunho7687
Copy link
Member Author

yunho7687 commented Dec 14, 2024

better to work together on this issue so no need to create a bunch of sub-issues

Copy link

Branch issue-36-Create_a_Quiz_relating_models created!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Task must have a back end issue database model database
Projects
None yet
Development

No branches or pull requests

3 participants