@@ -3,14 +3,13 @@ import type { Types } from 'mongoose'
33import type { CourseDocument } from '../models/Course'
44import type { PaginateOption , SortOption } from '../types'
55import type { QueryFilter } from '../types/mongo'
6- import { ParticipationStatus } from '@putongoj/shared'
6+ import { JudgeStatus , ParticipationStatus } from '@putongoj/shared'
77import { escapeRegExp } from 'lodash'
88import Contest from '../models/Contest'
99import ContestParticipation from '../models/ContestParticipation'
1010import Problem from '../models/Problem'
1111import Solution from '../models/Solution'
1212import User from '../models/User'
13- import { judge } from '../utils/constants'
1413import { CacheKey , cacheService } from './cache'
1514
1615async function findContests (
@@ -125,7 +124,7 @@ export type ContestProblemsWithStats = {
125124 solve : number
126125} [ ]
127126
128- const ignoredJudges = [ judge . CompileError , judge . SystemError , judge . Skipped ] as number [ ]
127+ const ignoredJudges = [ JudgeStatus . CompileError , JudgeStatus . SystemError , JudgeStatus . Skipped ] as number [ ]
129128
130129async function getProblemsWithStats ( contest : Types . ObjectId , isJury : boolean ) {
131130 return await cacheService . getOrCreate < ContestProblemsWithStats > (
@@ -160,7 +159,7 @@ async function getProblemsWithStats (contest: Types.ObjectId, isJury: boolean) {
160159 Solution . distinct ( 'uid' , {
161160 mid : contestId ,
162161 pid,
163- judge : judge . Accepted ,
162+ judge : JudgeStatus . Accepted ,
164163 createdAt : { $lt : before } ,
165164 } ) . lean ( ) ,
166165 ] )
@@ -175,7 +174,7 @@ async function getProblemsWithStats (contest: Types.ObjectId, isJury: boolean) {
175174 )
176175}
177176
178- const pendingJudges = [ judge . Pending , judge . RejudgePending , judge . Running ] as number [ ]
177+ const pendingJudges = [ JudgeStatus . Pending , JudgeStatus . RejudgePending , JudgeStatus . RunningJudge ] as number [ ]
179178
180179async function getRanklist ( contest : Types . ObjectId , isJury : boolean ) {
181180 return await cacheService . getOrCreate < ContestRanklist > (
@@ -231,7 +230,7 @@ async function getRanklist (contest: Types.ObjectId, isJury: boolean) {
231230 return
232231 }
233232
234- if ( judgement === judge . Accepted ) {
233+ if ( judgement === JudgeStatus . Accepted ) {
235234 item . solvedAt = createdAt . toISOString ( )
236235 return
237236 }
0 commit comments