Skip to content

Commit

Permalink
fix: FlareSkill PB update
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyoo committed Aug 24, 2024
1 parent cbddbac commit 3b5c241
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
18 changes: 11 additions & 7 deletions server/src/game-implementations/games/ddr.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
GoalFmtPercent,
GoalFmtScore,
GoalOutOfFmtPercent,
GoalOutOfFmtScore,
GradeGoalFormatter,
} from "./_common";
import { GoalFmtScore, GoalOutOfFmtScore, GradeGoalFormatter } from "./_common";
import db from "../../external/mongo/db";
import { IsNullish } from "../../utils/misc";
import { CreatePBMergeFor } from "../utils/pb-merge";
Expand Down Expand Up @@ -260,6 +254,16 @@ export const DDR_IMPL: GPTServerImplementation<"ddr:DP" | "ddr:SP"> = {
base.scoreData.score = score.scoreData.score;
base.scoreData.grade = score.scoreData.grade;
}),
CreatePBMergeFor("largest", "optional.enumIndexes.flare", "Best Flare", (base, score) => {
base.scoreData.optional.flare =
score.scoreData.lamp !== "FAILED"
? score.scoreData.optional.flare
: base.scoreData.optional.flare;
base.calculatedData.flareSkill =
score.scoreData.lamp !== "FAILED"
? score.calculatedData.flareSkill
: base.calculatedData.flareSkill;
}),
],
profileCalcs: {
flareSkill: async (game: Game, playtype: Playtype, userID: integer) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ export function CreateEnumIndexes<GPT extends GPTString>(gpt: GPT, metrics: any,
indexes[key] = index;
}

for (const [key, conf] of [
...Object.entries(gptConfig.providedMetrics),
...Object.entries(gptConfig.derivedMetrics),
]) {
for (const [key, conf] of [...Object.entries(gptConfig.optionalMetrics)]) {
if (conf.type !== "ENUM") {
continue;
}
Expand All @@ -103,7 +100,7 @@ export function CreateEnumIndexes<GPT extends GPTString>(gpt: GPT, metrics: any,
);
}

indexes[key] = index;
optionalIndexes[key] = index;
}

return {
Expand Down

0 comments on commit 3b5c241

Please sign in to comment.