Index

public.exercises

Description

Exercise is an collection of exercise tasks. The exercise itself does not contain any information on what kind of activities it contains – that information lives inside the tasks. This enables us for example to combine different exercise types or to provide different assignments to different students.

Columns

Name Type Default Nullable Children Parents Comment
chapter_id uuid true public.chapters (Redundant) Chapter in which the exercise belongs to.
copied_from uuid true public.exercises The original exercises record of a copy.
course_id uuid true public.courses Course where this exercise belongs to. Exercises are related to courses and not to course instances because if a course instance wants to have a different exercise from other course instances, the teacher is supposed to clone the course to create a new one.
created_at timestamp with time zone now() false Timestamp when the record was created
deadline timestamp with time zone true Overrides the deadline from the chapter. Should be null if we want to use the same deadline as in the chapter.
deleted_at timestamp with time zone true Timestamp when the record was deleted. If null, the record is not deleted.
exam_id uuid true public.exams The exam the exercise is associated with.
exercise_language_group_id uuid true public.exercise_language_groups If the exercise is related to a course, this can be used to find this exercise in other languages. If two exercises share the same id, they are the same exercise but in different languages. For exercises not related to a course, like exam exercises, this is always null.
id uuid uuid_generate_v4() false public.exercise_slide_submissions public.exercise_slides public.exercise_task_gradings public.exercises public.offered_answers_to_peer_review_temporary public.peer_or_self_review_configs public.peer_or_self_review_submissions public.peer_review_queue_entries public.user_exercise_states A unique, stable identifier for the record.
limit_number_of_tries boolean false false Whether the number of attempts the user is allowed to submit an exercise slide is limited. If true, the actual limit is defined by max_tries_per_slide. If null, the limit is unlimited.
max_tries_per_slide integer true The maximum number of attempts the user is allowed submit the exercise for each slide. Enforced only if limit_number_of_tries is true. If limit_number_of_tries is false, this column just stores what the teacher has previously typed in the exercise editor.
name varchar(255) false A human readable name of the exercise.
needs_peer_review boolean false false Does this exercise need to be peer reviewed before it can be marked as complete. The corresponding peer review can be found from the peer reviews table.
needs_self_review boolean false false If true, students are required to review their own submissions before getting any points.
order_number integer 0 false Used for sorting the exercises within a chapter.
page_id uuid false public.pages Page where this exercise can be found on.
score_maximum integer 1 false Maximum number of points that can be obtained from this exercise.
updated_at timestamp with time zone now() false Timestamp when the record was last updated. The field is updated automatically by the set_timestamp trigger.
use_course_default_peer_or_self_review_config boolean true false Shows if exercise uses course’s default peer review config. Default peer review config is needed to exists for this to work. Default peer review config is shared among all course’s exercises that has this set to true

Constraints

Name Type Definition Comment
check_exercise_language_group_id_defined CHECK CHECK (((course_id IS NULL) OR ((course_id IS NOT NULL) AND (exercise_language_group_id IS NOT NULL))))
course_or_exam_id_set CHECK CHECK (((course_id IS NULL) <> (exam_id IS NULL))) An exercise must be associated with either a course or an exam.
exercises_chapter_id_fkey FOREIGN KEY FOREIGN KEY (chapter_id) REFERENCES chapters(id)
exercises_copied_from_fkey FOREIGN KEY FOREIGN KEY (copied_from) REFERENCES exercises(id)
exercises_course_id_fkey FOREIGN KEY FOREIGN KEY (course_id) REFERENCES courses(id)
exercises_exam_id_fkey FOREIGN KEY FOREIGN KEY (exam_id) REFERENCES exams(id)
exercises_exercise_language_group_id_fkey FOREIGN KEY FOREIGN KEY (exercise_language_group_id) REFERENCES exercise_language_groups(id)
exercises_page_id_fkey FOREIGN KEY FOREIGN KEY (page_id) REFERENCES pages(id)
exercises_pkey PRIMARY KEY PRIMARY KEY (id)

Indexes

Name Definition
exercises_course_id_idx CREATE INDEX exercises_course_id_idx ON public.exercises USING btree (course_id)
exercises_pkey CREATE UNIQUE INDEX exercises_pkey ON public.exercises USING btree (id)

Triggers

Name Definition
set_timestamp CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.exercises FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp()

Relations

er

Generated by tbls