-
Notifications
You must be signed in to change notification settings - Fork 1
Contest Queries
Bowen Yu edited this page Apr 26, 2016
·
9 revisions
Type Definitions
Queries
- Get Contests
- Get Contest Info
- Set Contest Info
- Create Contest
- Edit Contest
- Exists Contest Id
- Contest Submissions
Defined by
/** @enum {string} */
coda.Scoring = {
BINARY: 'binary',
PROBLEM_SCORING: 'problem-scoring',
BATCH_SCORING: 'batch-scoring'
};
{
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>
}
{
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
}
}
Lists the active/scheduled/finished contests.
listContests(type)
Params
type: string // 'active', 'scheduled', 'past'
Return
!Array<coda.Contest>
Gets contest info, including start/end time, problems, etc.
getContestInfo(contestId)
Params
contestId: string
Return
coda.Contest
Sets the contest info for moderator editing.
setContestInfo(contestId)
Params
contestId: string
Return
Creates a contest and allocates a contest id.
createContest(contestId)
Params contestId: string Return { // empty or failure message }
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
}
existContestId(contestId)
Params
contestId: string
Return
{
exist: boolean
}
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
}>
}