mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-13 17:58:42 +03:00
Merge pull request #625 from TNG-dev:zkldi/issue-589
Fixes #589 - Make UpdateClass util also set a recentAchievement.
This commit is contained in:
@@ -180,6 +180,21 @@ t.test("POST /ir/fervidex/class/submit", (t) => {
|
||||
|
||||
t.equal(ugs?.classes.dan, 18);
|
||||
|
||||
const recentAchievement = await db["class-achievements"].findOne({
|
||||
userID: 1,
|
||||
game: "iidx",
|
||||
playtype: "SP",
|
||||
});
|
||||
|
||||
t.hasStrict(recentAchievement, {
|
||||
userID: 1,
|
||||
game: "iidx",
|
||||
playtype: "SP",
|
||||
classValue: 18,
|
||||
classSet: "dan",
|
||||
classOldValue: null,
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
@@ -69,6 +69,16 @@ export async function UpdateClassIfGreater(
|
||||
await CreateGameSettings(userID, game, playtype);
|
||||
}
|
||||
|
||||
await db["class-achievements"].insert({
|
||||
game,
|
||||
playtype,
|
||||
userID,
|
||||
classOldValue: isGreater === null ? null : userGameStats!.classes[classSet]!,
|
||||
classSet,
|
||||
classValue: classVal,
|
||||
timeAchieved: Date.now(),
|
||||
});
|
||||
|
||||
if (isGreater === null) {
|
||||
EmitWebhookEvent({
|
||||
type: "class-update/v1",
|
||||
|
||||
Reference in New Issue
Block a user