fix: auto promotion not working as expecting
parent
707d7204dc
commit
af95defd9a
|
|
@ -132,11 +132,25 @@ Deno.test("RankTracker autotrack after promotion", async () => {
|
|||
},
|
||||
}]);
|
||||
|
||||
const gameId1 = await gameId(genId(1));
|
||||
assertEquals(finalState, {
|
||||
gameId: await gameId(genId(1)),
|
||||
gameId: gameId1,
|
||||
rank: "A-",
|
||||
rankPoint: 200,
|
||||
});
|
||||
|
||||
assertEquals(await tracker.getRankStateById(genId(1)), {
|
||||
before: {
|
||||
gameId: await gameId(genId(0)),
|
||||
rank: "B+",
|
||||
rankPoint: -1,
|
||||
},
|
||||
after: {
|
||||
gameId: gameId1,
|
||||
rank: "A-",
|
||||
rankPoint: 200,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Deno.test("RankTracker tracks promotion, ignoring INPROGRESS", async () => {
|
||||
|
|
|
|||
|
|
@ -331,6 +331,7 @@ export class RankTracker {
|
|||
return;
|
||||
}
|
||||
|
||||
this.state = curState;
|
||||
const deltaList = generateDeltaList(curState, flatten);
|
||||
|
||||
if (!deltaList) {
|
||||
|
|
|
|||
|
|
@ -492,6 +492,16 @@ export class StatInkExporter implements GameExporter {
|
|||
result.rank_exp_change === undefined
|
||||
) {
|
||||
result.rank_exp_change = result.rank_after_exp - result.rank_before_exp;
|
||||
} else if (
|
||||
bankaraMatchChallenge?.isUdemaeUp &&
|
||||
bankaraMatchChallenge.earnedUdemaePoint
|
||||
) {
|
||||
// If the before state is generated by auto promotion, the rank_before_exp is wrong.
|
||||
// And `earnedUdemaePoint` from splatnet3 is -xxx.
|
||||
// So we calcuate `rank_before_exp` and remove `rank_exp_change` here
|
||||
result.rank_before_exp = result.rank_after_exp -
|
||||
bankaraMatchChallenge.earnedUdemaePoint;
|
||||
result.rank_exp_change = undefined;
|
||||
}
|
||||
|
||||
if (!result.rank_after) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue