Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: FlareSkill PB update #1162

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)]) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jesus this is a pretty rough bug. will need to merge this and then maybe run some rederivations on the database....

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
Loading