Skip to content

Commit 71db74d

Browse files
committed
fix hydro balloon objectid
1 parent 582e6ea commit 71db74d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/server/handler/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ class ClientBalloonDoneHandler extends Handler {
107107
async post(params) {
108108
const client = await this.ctx.db.client.findOne({ id: params.cid });
109109
if (!client) throw new ForbiddenError('Client', null, 'Client not found');
110-
const balloon = await this.ctx.db.balloon.findOne({ balloonid: +params.bid });
110+
const balloon = await this.ctx.db.balloon.findOne({ balloonid: params.bid });
111111
if (!balloon) throw new ValidationError('Balloon', params.bid, 'Balloon not found');
112-
await this.ctx.db.balloon.updateOne({ balloonid: +params.bid }, { $set: { printDone: 1, printDoneAt: new Date().getTime() } });
112+
await this.ctx.db.balloon.updateOne({ balloonid: params.bid }, { $set: { printDone: 1, printDoneAt: new Date().getTime() } });
113113
if (!balloon.done) await this.ctx.fetcher.setBalloonDone(balloon.balloonid);
114114
await this.ctx.parallel('balloon/doneTask', client._id, 1);
115115
this.response.body = { code: 1 };

packages/server/service/fetcher.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ class DOMjudgeFetcher extends BasicFetcher {
134134
totalDict[t.problem] = t.contestproblem;
135135
}
136136
const shouldPrint = this.contest.info.freeze_time ? (balloon.time * 1000) < this.contest.info.freeze_time || encourage : true;
137-
if (!shouldPrint && !balloon.done) await this.setBalloonDone(balloon.balloonid);
138-
await this.ctx.db.balloon.update({ balloonid: balloon.balloonid }, {
137+
if (!shouldPrint && !balloon.done) await this.setBalloonDone(balloon.balloonid.toString());
138+
await this.ctx.db.balloon.update({ balloonid: balloon.balloonid.toString() }, {
139139
$set: {
140-
balloonid: balloon.balloonid,
140+
balloonid: balloon.balloonid.toString(),
141141
time: (balloon.time * 1000).toFixed(0),
142142
problem: balloon.problem,
143143
contestproblem: balloon.contestproblem,
@@ -160,7 +160,7 @@ class DOMjudgeFetcher extends BasicFetcher {
160160
this.logger.debug(`Found ${balloons.length} balloons`);
161161
}
162162

163-
async setBalloonDone(bid) {
163+
async setBalloonDone(bid: string) {
164164
await fetch(`./api/v4/contests/${this.contest.id}/balloons/${bid}/done`, 'post');
165165
this.logger.debug(`Balloon ${bid} set done`);
166166
}
@@ -246,7 +246,7 @@ class HydroFetcher extends BasicFetcher {
246246
}
247247

248248
async setBalloonDone(bid) {
249-
await fetch(`/d/${this.contest.domainId}/contest/${this.contest.id}/balloon`, 'post').send({ balloon: bid });
249+
await fetch(`/d/${this.contest.domainId}/contest/${this.contest.id}/balloon`, 'post').send({ operation: 'done', balloon: bid });
250250
this.logger.debug(`Balloon ${bid} set done`);
251251
}
252252
}

0 commit comments

Comments
 (0)