Skip to content

Commit 82ff904

Browse files
author
robot
committed
feat: 补卡数据
1 parent bceec30 commit 82ff904

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

config/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ MellonGuan
227227
Size-of
228228
oborc
229229
Daniel-Zheng
230-
thisisandy
230+
thisisandygl
231231
Yvonne1231-Wang
232232
Gentlemancj
233233
bolunzhang2021

routes/dailyProblem.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@ const { startTime } = require("../config/index");
99

1010
const A = [];
1111
for (const [login, solution] of Object.entries(mySolutions)) {
12-
A.push({ count: solution.filter(Boolean).length, ...users[login] });
12+
const { bio, name, noCheck, allCheck, avatar_url } = users[login];
13+
A.push({
14+
count: solution.filter(Boolean).length,
15+
bio,
16+
name,
17+
login,
18+
noCheck,
19+
avatar_url,
20+
allCheck,
21+
});
1322
}
1423

1524
const rankings = A.sort((a, b) => b.count - a.count);

schedule/daily-check.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,14 @@ async function run(d) {
3737
mySolutions[login] = Array(91);
3838
}
3939
// 由于下面的一行代码,导致了会插入一个完全空的行。这就是因为打过卡,但是都不是当天打的
40-
if (
41-
getDay(new Date(comment.created_at).getTime()) > d ||
42-
comment.body.length < 20
43-
)
44-
return;
40+
if (comment.body.length < 20) return;
41+
// 由于索引从 1 开始,因此需要再减去 1。
4542
mySolutions[login][d - 1] = {
4643
// title: problem.title,
4744
url: comment.html_url,
4845
body: comment.body,
49-
}; // 由于索引从 1 开始,因此需要再减去 1。
46+
onTime: getDay(new Date(comment.created_at).getTime()) <= d,
47+
};
5048
});
5149
fs.writeFileSync(
5250
path.resolve(__dirname, "../static/my/solutions.json"),
@@ -56,7 +54,10 @@ async function run(d) {
5654
}
5755
const MS_PER_HOUR = 1 * 60 * 60 * 1000;
5856
const TODAY = getDay(new Date().getTime() - MS_PER_HOUR); // 获取今天‘的题目。 为了照顾一些人, 我们凌晨一点统计昨天的,而不是当天的。
59-
run(TODAY);
6057

61-
// fix: 用于修正之前的数据错误
62-
// run(3);
58+
// 1. 记录打卡数据
59+
// 2. 修正之前的数据错误
60+
// 3. 登记补卡信息
61+
for (let d = 1; d <= TODAY; d++) {
62+
run(d);
63+
}

static/my/solutions.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)