Skip to content

Contests and Questions tracker #60

Open
@ridhishjain-zepto

Description

@ridhishjain-zepto

Tables

  • contests table
id (primary key)
show_leaderboard (tiny int, 0/1)
public (tiny int, 0/1)
confidential_questions (tiny int, default 0)
creator (username, admin only, foreign key from users table)
name (string)
start_time (timestamp)
end_time (timestamp)
participants_count (int)
about (string)
rules (string, can be null)
prizes (string, can be null)
  • contests_groups_map table
id (primary key)
contest_id (foreign key from `contests` table)
group_id (foreign key from `groups` table)
  • contests_moderators_map table
id (primary key)
contest_id (foreign key from `contests` table)
moderator_username (foreign key from `users` table)
  • contests_participants_map table
id (primary key)
contest_id (foreign key from `contests` table)
participant_username (foreign key from `users` table)
  • questions table
id (primary key)
creator (foreign key from `users` table)
type (tiny int, 0 - MCQ, similar)
name (string)
problem statement (string)
input_format (string)
output_format (string)
constraints (string)
options (string, JSON array)
correct (int, index of correct option)
difficulty (int, 1-easy, 2-medium, 3-hard, can be 0 by default - not specified)
  • questions_editors_map table
id (primary key)
question_id (foreign key from `questions` table)
editor_username (foreign key from `users` table)
  • tags table
id (primary key)
description (string)
name (string)
  • questions_tags_map table
id (primary key)
question_id (foreign key from `questions` table)
tag_id (foreign key from `tags` table)
  • contests_questions_map table
id (primary key)
question_id (foreign key from `questions` table)
contest_id (foreign key from `contests` table)
max_score (int)
  • mcq_submissions table
id (primary key)
question_id (foreign_key from `questions` table)
contest_id (foreign_key from `contests` table)
username (foreign_key from `users` table)
response (int, index of option selected),
submission_time (timestamp)
judged (tiny int, default 0)
score (int, default 0)
  • subjective_submissions table
id (primary key)
question_id (foreign_key from `questions` table)
contest_id (foreign_key from `contests` table)
username (foreign_key from `users` table)
response (text),
submission_time (timestamp)
judged (tiny int, default 0)
score (int, default 0)
feedback (varchar, if the moderator wants to give any feedback after checking)
  • leaderboard table
id (primary key)
uesrname (foreign key from `users` table)
contest_id (foreign_key from `contests` table)
score (int, total score)
total_time (time, total penalty yet)
attempted_count (int)

API

Contests API

  • createContest
    POST /contests/ Admin only

  • updateContest
    POST /contests/:contest_id/update Moderator only

  • addModerator
    POST /contests/:contest_id/moderator Moderator only

  • removeModerator
    DELETE /contests/:contest_id/moderator Moderator only

  • addGroup
    POST /contests/:contest_id/:groups Moderator only

  • removeGroup
    DELETE /contests/:contest_id/groups Moderator only

  • getContests
    GET /contests?status=active&limit=5

  • getModeratorContests
    GET /contests/moderator_contests?limit=5 Moderator only

  • getContest
    GET /contests/:contest_id

  • getContestDetails
    GET /contests/:contest_id/details?only_name=false Moderator only

  • getContestModerators
    GET /contests/:contest_id/moderators Moderator only

  • getAllParticipants
    GET /contests/:contest_id/participants

  • getAllParticipantsDetails
    GET /contests/:contest_id/participants_details Moderator only

  • participate
    POST /contests/:contest_id/participate

  • addQuestion
    POST /contests/:contest_id/:questions

  • removeQuestion
    DELETE /contests/:contest_id/questions

  • getAllQuestions
    GET /contests/:contest_id/questions

  • getQuestion
    GET /contests/:contest_id/questions/:question_id

Questions API:

  • createQuestion
    POST /questions/ Admin only: to create a question

  • getModeratorQuestions
    GET /questions/moderator_questions?limit=5&search=’’ Moderator only: show the questions for which user is a moderator

  • getQuestion
    GET /questions/:question_id, Editor only: to get the question

  • updateQuestion
    POST /questions/:question_id/update, Editor only: to edit the questions, the change will be reflected in all instances of the question

  • getAllQuestions
    GET /questions/: - send all public questions with their contest_id (for practice section)

  • addEditor
    POST /questions/:question_id/editor Editor only: Add editor to a question

  • removeEditor
    DELETE /questions/:question_id/editor Editor only: Remove editor to a question (creator can't be removed)

  • forkQuestion
    POST /questions/:question_id/fork Editor only: Return the id of the forked new question

Submissions API

  • createSubmission
    POST /contests/:contest_id/questions/:question_id/submit All participants: everyone eligible for the contest should be allowed (For MCQ, allow only 1 attempt)

  • getAllSubmissions
    GET /contests/:contest_id/submissions Contest Moderator only: See all submissions (pagination, sorting, filtering and searching enabled)

  • getUserContestSubmissions
    GET /contests/:contest_id/users/:user_id/submissions The user only: get all submissions of a user

  • gradeSubjectiveSubmission
    POST /contests/:contest_id/subjective_submissions/:submission_id/grade Contest Moderator only: Grade a subjective submission providing a score along with an optional feedback. (If submission is already judged/graded, update it)

  • getMCQSubmission
    GET /contests/:contest_id/mcq_submissions/:submission_id Only the specific user: Get a specific MCQ submission
    GET /contests/:contest_id/mcq_submissions/:submission_id?moderator=true Contest Moderator only: Get a specific MCQ submission

  • getSubjectiveSubmission
    GET /contests/:contest_id/subjective_submissions/:submission_id Only the specific user: Get a specific subjective submission.
    GET /contests/:contest_id/subjective_submissions/:submission_id?moderator=true Contest Moderator only: Get a specific subjective submission

  • getContestLeaderboard
    GET /contests/:contest_id/leaderboard All participants: Everyone should be allowed, if show_leaderboard is true, otherwise allow only contest moderators.

  • getQuestionLeaderboard
    GET /contests/:contest_id/questions/:question_id/leaderboard:Everyone should be allowed, if show_leaderboard is true, otherwise allow only contest moderators.

  • getPracticeLeaderboard
    GET /practice/leaderboard: accessible to all

Tags API:

  • createTag
    POST /tag Admin only:

  • getTag
    GET /tag?search=keyword

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions