返回提交历史
Modified
src/services/guildService.ts
+5
-4
XFEstudio/SpaceNinjaServer
fix: offset DestructionTimeRemaining by 1, align CeremonyResetDate to seconds (#3315)
Closes #3314 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3315 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
f1336975
代码差异
1 个文件
+5
-4
@@ -229,9 +229,8 @@ export const getDojoClient = async (
229
229
continue;
230
230
}
231
231
clientComponent.DestructionTime = toMongoDate(dojoComponent.DestructionTime);
232
clientComponent.DestructionTimeRemaining = Math.trunc(
233
(dojoComponent.DestructionTime.getTime() - Date.now()) / 1000
234
);
232
clientComponent.DestructionTimeRemaining =
233
1 + Math.trunc((dojoComponent.DestructionTime.getTime() - Date.now()) / 1000);
235
234
}
236
235
} else {
237
236
clientComponent.RegularCredits = dojoComponent.RegularCredits;
@@ -661,7 +660,9 @@ export const checkClanAscensionHasRequiredContributors = async (guild: TGuildDat
661
660
if (guild.CeremonyContributors!.length >= requiredContributors) {
662
661
guild.Class = guild.CeremonyClass!;
663
662
guild.CeremonyClass = undefined;
664
guild.CeremonyResetDate = new Date(Date.now() + (guild.fastClanAscension ? 5_000 : 72 * 3600_000));
663
guild.CeremonyResetDate = new Date(
664
Math.trunc(Date.now() / 1000) * 1000 + (guild.fastClanAscension ? 5_000 : 72 * 3600_000)
665
);
665
666
if (!guild.fastClanAscension) {
666
667
// Send message to all active guild members
667
668
const members = await GuildMember.find({ guildId: guild._id, status: 0 }, "accountId");