添加cache-loader,debug模式下不再使用template缓存,修复一些 bug

This commit is contained in:
undefined committed 2020-07-11 20:00:43 +08:00
1 parent dd7914e1fb
commit 11368bc831
21 files changed
+248 -266

No files matched your search

+19 -15
View File
@@ -51,7 +51,7 @@ const acm = {
if (!j.accept) naccept[j.pid]++;
}
function _time(jdoc) {
const real = jdoc.rid.generationTime - Math.floor(tdoc.begin_at / 1000);
const real = jdoc.rid.generationTime - Math.floor(tdoc.beginAt / 1000);
const penalty = 20 * 60 * naccept[jdoc.pid];
return real + penalty;
}
@@ -73,23 +73,27 @@ const acm = {
{ type: 'solved_problems', value: _('Solved Problems') },
];
if (isExport) {
columns.push({ type: 'total_time', value: _('Total Time (Seconds)') });
columns.push({ type: 'total_time_str', value: _('Total Time') });
columns.push(
{ type: 'total_time', value: _('Total Time (Seconds)') },
{ type: 'total_time_str', value: _('Total Time') },
);
}
for (const i in tdoc.pids) {
if (isExport) {
columns.push({
type: 'problem_flag',
value: '#{0} {1}'.format(i + 1, pdict[tdoc.pids[i]].title),
});
columns.push({
type: 'problem_time',
value: '#{0} {1}'.format(i + 1, _('Time (Seconds)')),
});
columns.push({
type: 'problem_time_str',
value: '#{0} {1}'.format(i + 1, _('Time')),
});
columns.push(
{
type: 'problem_flag',
value: '#{0} {1}'.format(i + 1, pdict[tdoc.pids[i]].title),
},
{
type: 'problem_time',
value: '#{0} {1}'.format(i + 1, _('Time (Seconds)')),
},
{
type: 'problem_time_str',
value: '#{0} {1}'.format(i + 1, _('Time')),
},
);
} else {
columns.push({
type: 'problem_detail',
+1 -1
View File
@@ -15,7 +15,7 @@ export const typeDisplay = {
};
export function add(
domainId: string, parentType: number, parentId: ObjectID,
domainId: string, parentType: number, parentId: ObjectID | number | string,
owner: number, title: string, content: string,
ip: string | null = null, highlight: boolean = false,
) {
+6 -7
View File
@@ -28,20 +28,19 @@ export function del(_id: ObjectID) {
export async function getFirst(query: any) {
const q = { ...query };
q.executeAfter = q.executeAfter || { $lt: new Date().getTime() };
const res = await coll.find(q).sort('_id', 1).limit(1).toArray();
if (res.length) {
await coll.deleteOne({ _id: res[0]._id });
if (res[0].interval) {
const res = await coll.findOneAndDelete(q);
if (res.value) {
if (res.value.interval) {
await coll.insertOne({
...res[0], executeAfter: moment().add(...res[0].interval).toDate(),
...res.value, executeAfter: moment().add(...res.value.interval).toDate(),
});
}
return res[0];
return res.value;
}
return null;
}
export async function consume(query, cb: Function) {
export async function consume(query: any, cb: Function) {
let isRunning = false;
const interval = setInterval(async () => {
if (isRunning) return;