Skip to content

Commit

Permalink
[Release] Release 3.30.28
Browse files Browse the repository at this point in the history
enhance result_string
  • Loading branch information
ryanlee2014 committed Jan 15, 2024
1 parent 60baa9b commit 5356c35
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "CUP-Online-Judge-BackEnd",
"author": "Ryan Lee <[email protected]>",
"homepage": "https://github.com/ryanlee2014",
"version": "3.30.27",
"version": "3.30.28",
"engines": {
"node": ">=12.0.0"
},
Expand Down
10 changes: 9 additions & 1 deletion src/manager/submission/SolutionManager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Request} from "express";
import SubmissionManager, {ExportSolutionInfo, SolutionInfoDAO} from "./SubmissionManager";
import SubmissionManager, {ExportSolutionInfo, RESULT_CHINESE_STRING, SolutionInfoDAO} from "./SubmissionManager";
import {ErrorHandlerFactory} from "../../decorator/ErrorHandler";
import {ok} from "../../module/constants/state";
import CompileInfoManager from "../judge/CompileInfoManager";
Expand Down Expand Up @@ -83,6 +83,7 @@ class SolutionManager {
async getSolutionExportInfoByContestId(req: Request) {
const contestId = parseInt(req.params.contestId);
const exportSolutionInfoList = await SubmissionManager.getSolutionExportInfoByContestId(contestId);
this.enhanceResultString(exportSolutionInfoList)
return this.convertFormatToMustache(exportSolutionInfoList);
}

Expand Down Expand Up @@ -142,8 +143,15 @@ class SolutionManager {
const res = Object.values(resultProblemInfoMap[resultProblemInfoMapKey]!)
resultSolutionInfoList.push(...res)
}
this.enhanceResultString(resultSolutionInfoList)
return this.convertLastFormatToMustache(resultSolutionInfoList);
}

enhanceResultString(exportSolutionInfoList: ExportSolutionInfo[]) {
exportSolutionInfoList.forEach(e => {
e.result_string = RESULT_CHINESE_STRING[e.result]
})
}
}

export default new SolutionManager();
24 changes: 23 additions & 1 deletion src/manager/submission/SubmissionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,27 @@ import {Request} from "express";

const cache_query = require("../../module/mysql_cache");

export const RESULT_CHINESE_STRING = [
"等待",
"等待重判",
"编译中",
"运行并评判",
"答案正确",
"格式错误",
"答案错误",
"时间超限",
"内存超限",
"输出超限",
"运行错误",
"编译错误",
"编译成功",
"运行完成",
"已加入队列",
"提交被拒绝",
"系统错误",
""
]

export interface SolutionInfoDAO {
problem_id: number,
user_id: string,
Expand Down Expand Up @@ -40,7 +61,8 @@ export interface ExportSolutionInfo {
nick: string,
source: string,
in_date: string,
result: number
result: number,
result_string?: string,
}

interface ProblemInfo {
Expand Down

0 comments on commit 5356c35

Please sign in to comment.