Skip to content

Contest Queries

Bowen Yu edited this page Apr 26, 2016 · 9 revisions

Type Definitions

Queries


Type Definitions

Coda Scoring

Defined by

/** @enum {string} */
coda.Scoring = {
  BINARY: 'binary',
  PROBLEM_SCORING: 'problem-scoring',
  BATCH_SCORING: 'batch-scoring'
};

Coda Contest

{
  id: string,
  title: string,
  description: string,
  startTime: number,              // Posix timestamp, integer
  endTime: number,                // Posix timestamp, integer
  scoring: coda.Scoring,
  // Problems are considered ordered. The first problem is Problem A.
  problems: !Array<coda.ContestProblem>
}

Coda Contest Problem

{
  id: string,                   // problem id (letters)
  title: string,
  score: number|!Array<number>  // based on scoring method
  stats: {
    userTotal: number,          // # of attempted users
    userSuccess: number         // # of succeeded users
  }
}

Queries

Get Contests

Lists the active/scheduled/finished contests.

listContests(type)

Params

type: string // 'active', 'scheduled', 'past'

Return

!Array<coda.Contest>

Get Contest Info

Gets contest info, including start/end time, problems, etc.

getContestInfo(contestId)

Params

contestId: string

Return

coda.Contest

Set Contest Info

Sets the contest info for moderator editing.

setContestInfo(contestId)

Params

contestId: string

Return


Create Contest

Creates a contest and allocates a contest id.

createContest(contestId)

Params contestId: string Return { // empty or failure message }

Edit Contest

Configures the contest.

editContest(contestId, params)

Params

contestId: string,
// Only non-null entries are considered to be set.
params: {
  title: ?string,
  description: ?string,
  startTime: ?number,
  endTime: ?number,
  access: ?string|Array<string>
  problems: Array<{
    index: number,                // problem index in this contest
    id: string,
    scoring: string,              // 'binary', 'problemScoring', 'batchScoring'
    score: number|!Array<number>  // based on scoring method
  }>
}

Return

{
  // empty or failure message
}

Exists Contest Id

existContestId(contestId)

Params

contestId: string

Return

{
  exist: boolean
}

Contest Submissions

Gets the submissions to a problem under a specific contest.

contestSubmissions(contestId, filters)

Params

contestId: string,
filters: ?{
  problemId: string,  // original problem id in letters, not problem index in the contest
  user: string,
  lang: string
}

Return

{
  submissions: !Array<{
    id: string,       // submission id
    user: string,     // who submitted
    time: number,     // Posix time
    lang: string,     // source language ('c', 'c++', 'java')
    size: number,     // source file size in bytes
    verdict: string   // result of submission
  }>
}