core: 优化AC量计算

- 比赛中不计入nAccept
- script.problemStat添加用户AC量统计
This commit is contained in:
undefined committed 2021-02-10 12:53:42 +08:00
1 parent 0ceb095314
commit fa1392fa4b
4 files changed
+56 -13

No files matched your search

+4 -2
View File
@@ -303,10 +303,12 @@ export async function setMultiStatus<K extends keyof DocStatusType>(
export async function setIfNotStatus<T extends keyof DocStatusType, K extends keyof DocStatusType[T]>(
domainId: string, docType: T, docId: DocStatusType[T]['docId'], uid: number,
key: K, value: number, ifNot: DocStatusType[T][K], args: Partial<DocStatusType[T]>,
key: K, value: DocStatusType[T][K], ifNot: DocStatusType[T][K], args: Partial<DocStatusType[T]>,
): Promise<DocStatusType[T]> {
const current = await collStatus.findOne({ domainId, docType, docId, uid }) || {};
if (current[key] === ifNot) return current;
const res = await collStatus.findOneAndUpdate(
{ domainId, docType, docId, uid, [key]: { $not: { $eq: ifNot } } },
{ domainId, docType, docId, uid },
{ $set: { [key]: value, ...args } },
{ upsert: true, returnOriginal: false },
);