From 9dd370fa72d8e3ce5fee5638270bc65a587ce1b8 Mon Sep 17 00:00:00 2001 From: undefined Date: Sat, 18 Jul 2020 13:27:39 +0800 Subject: [PATCH] update .npmignore --- .npmignore | 24 ++++++++++++------------ hydro/handler/judge.ts | 27 ++------------------------- hydro/interface.ts | 1 - package.json | 4 ++-- 4 files changed, 16 insertions(+), 40 deletions(-) diff --git a/.npmignore b/.npmignore index a785b74a..3e1c86b2 100644 --- a/.npmignore +++ b/.npmignore @@ -1,15 +1,15 @@ -node_modules +node_modules/ +ui/ +config.yaml config.json -docker-compose.yml -Dockerfile +.cache/ +*.cache +__* +*.log +*.hydro +locales +templates +wiki .vscode .github -public/ -templates -ui -locales -module -hydro -build -tool -.build/install.js +examples diff --git a/hydro/handler/judge.ts b/hydro/handler/judge.ts index 74615ad1..a9c86f65 100644 --- a/hydro/handler/judge.ts +++ b/hydro/handler/judge.ts @@ -13,31 +13,10 @@ import { Route, Handler, Connection, ConnectionHandler, Types, param, } from '../service/server'; -interface _PostJudgeBody { - status: number, - domainId: string, - uid: number, - _id: ObjectID, - pid: number, - score: number, - rejudged: boolean, -} - -interface PostJudgeBodyContest extends _PostJudgeBody { - tid: ObjectID, - ttype: number, -} - -type PostJudgeBody = _PostJudgeBody | PostJudgeBodyContest; - -function _isWithContest(v: PostJudgeBody): v is PostJudgeBodyContest { - return !!((v as PostJudgeBodyContest).tid); -} - -async function _postJudge(rdoc: PostJudgeBody) { +async function _postJudge(rdoc: Rdoc) { const accept = rdoc.status === builtin.STATUS.STATUS_ACCEPTED; const tasks = []; - if (_isWithContest(rdoc)) { + if (rdoc.tid) { tasks.push( contest.updateStatus( rdoc.domainId, rdoc.tid, rdoc.uid, @@ -58,7 +37,6 @@ async function _postJudge(rdoc: PostJudgeBody) { export async function next(body: JudgeResultBody) { if (body.rid) body.rid = new ObjectID(body.rid); - if (body.tid) body.tid = new ObjectID(body.tid); let rdoc = await record.get(body.domainId, body.rid); const $set: any = {}; const $push: any = {}; @@ -90,7 +68,6 @@ export async function next(body: JudgeResultBody) { export async function end(body: JudgeResultBody) { if (body.rid) body.rid = new ObjectID(body.rid); - if (body.tid) body.tid = new ObjectID(body.tid); let rdoc = await record.get(body.domainId, body.rid); const $set: any = {}; const $push: any = {}; diff --git a/hydro/interface.ts b/hydro/interface.ts index 23ee129e..94d7aaad 100644 --- a/hydro/interface.ts +++ b/hydro/interface.ts @@ -203,7 +203,6 @@ export interface JudgeResultBody { domainId: string, rid: ObjectID, judger?: number, - tid?: ObjectID, progress?: number case?: { status: number, diff --git a/package.json b/package.json index dd357d3b..6e40abfa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "2.8.2", + "version": "2.8.5", "main": "hydro/loader.ts", "repository": "https://github.com/hydro-dev/Hydro.git", "author": "masnn", @@ -96,4 +96,4 @@ ] }, "snyk": true -} +} \ No newline at end of file