优化rating计算速度

This commit is contained in:
masnn committed 2020-06-09 13:22:04 +08:00
1 parent 45f1184d68
commit 55912b087d
22 files changed
+309 -178

No files matched your search

+3 -2
View File
@@ -207,7 +207,8 @@ const RULES = {
* @returns {ObjectID} tid
*/
function add(domainId, title, content, owner, rule,
beginAt = new Date(), endAt = new Date(), pids = [], data = {}, type = document.TYPE_CONTEST) {
beginAt = new Date(), endAt = new Date(), pids = [], rated = false,
data = {}, type = document.TYPE_CONTEST) {
validator.checkTitle(title);
validator.checkContent(content);
if (!this.RULES[rule]) throw new ValidationError('rule');
@@ -217,7 +218,7 @@ function add(domainId, title, content, owner, rule,
});
this.RULES[rule].check(data);
return document.add(domainId, content, owner, type, null, null, null, {
...data, title, rule, beginAt, endAt, pids, attend: 0,
...data, title, rule, beginAt, endAt, pids, attend: 0, rated,
});
}