mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
migrate: handle bigint
This commit is contained in:
1 file changed
+11
-5
@@ -288,10 +288,11 @@ hydrooj install https://hydro.ac/hydroac-client.zip
|
|||||||
lint_error int N ???
|
lint_error int N ???
|
||||||
judger char(16) N 判题机
|
judger char(16) N 判题机
|
||||||
*/
|
*/
|
||||||
const [{ 'count(*)': rcount }] = await query('SELECT count(*) FROM `solution`');
|
const [{ 'count(*)': _rcount }] = await query('SELECT count(*) FROM `solution`');
|
||||||
const rpageCount = Math.ceil(Number(rcount) / step);
|
const rcount = BigInt(_rcount);
|
||||||
for (let pageId = 0; pageId < rpageCount; pageId++) {
|
const rpageCount = rcount / BigInt(step) + (rcount % BigInt(step) === 0n ? 0n : 1n);
|
||||||
const rdocs = await query(`SELECT * FROM \`solution\` LIMIT ${pageId * step}, ${step}`);
|
for (let pageId = 0n; pageId < rpageCount; pageId++) {
|
||||||
|
const rdocs = await query(`SELECT * FROM \`solution\` LIMIT ${pageId * BigInt(step)}, ${step}`);
|
||||||
for (const rdoc of rdocs) {
|
for (const rdoc of rdocs) {
|
||||||
const data: RecordDoc = {
|
const data: RecordDoc = {
|
||||||
status: statusMap[rdoc.result] || 0,
|
status: statusMap[rdoc.result] || 0,
|
||||||
@@ -328,7 +329,12 @@ hydrooj install https://hydro.ac/hydroac-client.zip
|
|||||||
await RecordModel.coll.insertOne(data);
|
await RecordModel.coll.insertOne(data);
|
||||||
await postJudge(data).catch((err) => report({ message: err.message }));
|
await postJudge(data).catch((err) => report({ message: err.message }));
|
||||||
}
|
}
|
||||||
if (pageId % 10 === 0) report({ message: `record finished ${pageId * step} / ${rcount} (${Math.round(((pageId * step) / rcount) * 100)}%)` });
|
if (pageId % 10n === 0n) {
|
||||||
|
const progress = Math.round(((Number(pageId) * step) / Number(rcount)) * 100);
|
||||||
|
report({
|
||||||
|
message: `record finished ${Number(pageId * BigInt(step))} / ${Number(rcount)} (${progress}%)`,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
report({ message: 'record finished' });
|
report({ message: 'record finished' });
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user