MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / stat

Method stat

packages/hydrooj/src/model/record.ts:64–77  ·  view source on GitHub ↗
(domainId?: string)

Source from the content-addressed store, hash-verified

62
63 @ArgMethod
64 static async stat(domainId?: string) {
65 const [d5min, d1h, day, week, month, year, total] = await Promise.all([
66 RecordModel.coll.countDocuments({ _id: { $gte: Time.getObjectID(moment().add(-5, 'minutes')) }, ...domainId ? { domainId } : {} }),
67 RecordModel.coll.countDocuments({ _id: { $gte: Time.getObjectID(moment().add(-1, 'hour')) }, ...domainId ? { domainId } : {} }),
68 RecordModel.coll.countDocuments({ _id: { $gte: Time.getObjectID(moment().add(-1, 'day')) }, ...domainId ? { domainId } : {} }),
69 RecordModel.coll.countDocuments({ _id: { $gte: Time.getObjectID(moment().add(-1, 'week')) }, ...domainId ? { domainId } : {} }),
70 RecordModel.coll.countDocuments({ _id: { $gte: Time.getObjectID(moment().add(-1, 'month')) }, ...domainId ? { domainId } : {} }),
71 RecordModel.coll.countDocuments({ _id: { $gte: Time.getObjectID(moment().add(-1, 'year')) }, ...domainId ? { domainId } : {} }),
72 domainId ? RecordModel.coll.countDocuments({ domainId }) : RecordModel.coll.estimatedDocumentCount(),
73 ]);
74 return {
75 d5min, d1h, day, week, month, year, total,
76 };
77 }
78
79 static async judge(
80 domainId: string, rids: MaybeArray<ObjectId> | RecordDoc, priority = 0,

Callers 7

getFilesFunction · 0.80
[Service.init]Method · 0.80
localeFunction · 0.80
updateStatusFunction · 0.80
recalcStatusFunction · 0.80
processJudgeFileCallbackFunction · 0.80
getMethod · 0.80

Calls 2

allMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected