vjudge: support for adding solutions (#1030)

This commit is contained in:
BlackPanda authored and GitHub committed 2025-08-07 19:48:23 +01:00
1 parent ea20debc97
commit a255f53aa5
2 files changed
+3 -1

No files matched your search

+2 -1
View File
@@ -4,7 +4,7 @@ import { LangConfig, STATUS } from '@hydrooj/common';
import {
Context, db, DomainModel, JudgeResultCallbackContext, Logger,
ProblemModel, RecordModel, Service, SettingModel,
sleep, SystemModel, TaskModel, Time, yaml,
sleep, SolutionModel, SystemModel, TaskModel, Time, yaml,
} from 'hydrooj';
import { BasicProvider, IBasicProvider, RemoteAccount } from './interface';
import providers from './providers/index';
@@ -109,6 +109,7 @@ class AccountService {
for (const key in res.data) {
await ProblemModel.addTestdata(domainId, docId, key, res.data[key]);
}
if (res.solution) await SolutionModel.add(domainId, docId, 1, res.solution);
logger.info(`${domainId}: problem ${docId}(${pid}) sync done -> ${targetPid}(${docId})`);
} finally {
delete syncing[`${domainId}/${pid}`];
+1
View File
@@ -35,6 +35,7 @@ export interface IBasicProvider {
tag: string[];
content: string;
difficulty?: number;
solution?: string;
}>;
entryProblemLists?: string[];
listProblem: (page: number, resync: boolean, listId: string) => Promise<string[]>;