mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
core: 优化AC量计算
- 比赛中不计入nAccept - script.problemStat添加用户AC量统计
This commit is contained in:
1 parent
0ceb095314
commit
fa1392fa4b
4 files changed
+56
-13
No files matched your search
@@ -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 },
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user