From 8779f03d8073c23f50ba8ca47f8f204fd0f135c0 Mon Sep 17 00:00:00 2001 From: undefined Date: Thu, 6 May 2021 12:15:10 +0800 Subject: [PATCH] core: add score declaration to psdoc --- packages/hydrooj/src/interface.ts | 15 ++++++++------- packages/hydrooj/src/pipelineUtils.ts | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/hydrooj/src/interface.ts b/packages/hydrooj/src/interface.ts index e49a7f97e..0cd1a7977 100644 --- a/packages/hydrooj/src/interface.ts +++ b/packages/hydrooj/src/interface.ts @@ -213,13 +213,14 @@ export interface StatusDoc { } export interface ProblemStatusDoc extends StatusDoc { - docId: number, - docType: 10, - rid?: ObjectID, - status?: number, - nSubmit?: number, - nAccept?: number, - star?: boolean, + docId: number; + docType: 10; + rid?: ObjectID; + score?: number; + status?: number; + nSubmit?: number; + nAccept?: number; + star?: boolean; } export interface TestCase { diff --git a/packages/hydrooj/src/pipelineUtils.ts b/packages/hydrooj/src/pipelineUtils.ts index 2159b2c5c..f9a773cc2 100644 --- a/packages/hydrooj/src/pipelineUtils.ts +++ b/packages/hydrooj/src/pipelineUtils.ts @@ -1,6 +1,6 @@ /* eslint-disable no-await-in-loop */ import { FilterQuery } from 'mongodb'; -import type { DomainDoc, Udoc } from './interface'; +import type { DomainDoc, Udoc, ProblemStatusDoc } from './interface'; import domain from './model/domain'; import * as document from './model/document'; import user from './model/user'; @@ -16,7 +16,7 @@ export async function iterateAllUser(cb: (udoc: Udoc, current?: number, total?: for (const i in udocs) await cb(udocs[i], +i, udocs.length); } -export async function iterateAllPsdoc(filter: FilterQuery, cb: (psdoc: any) => Promise) { +export async function iterateAllPsdoc(filter: FilterQuery, cb: (psdoc: ProblemStatusDoc) => Promise) { await iterateAllDomain(async ({ _id: domainId }) => { const cursor = document.getMultiStatus(domainId, document.TYPE_PROBLEM, filter); while (await cursor.hasNext()) {