Skip to content

Commit

Permalink
feat: remove >100% scores
Browse files Browse the repository at this point in the history
i'm ill as fuck man
  • Loading branch information
zkrising committed Dec 5, 2024
1 parent 08177b6 commit e4e62e3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ mod docs
interactive:
-@just --choose

install:
pnpm install

# Run the frontend and backend for Tachi.
#
# This is the main command you want to use to start up tachi. Go for it!
start:
start: install
parallel --lb ::: 'FORCE_COLOR=1 just server start' 'FORCE_COLOR=1 just client start'

# test everything
Expand Down
8 changes: 7 additions & 1 deletion server/src/lib/migration/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import KtRatingToCuratorSkill from "./migrations/ktRating-to-curator-skill";
import MarkFervidexAsWithoutIntent from "./migrations/mark-fervidex-as-without-intent";
import MarkKsHookAsWithoutIntent from "./migrations/mark-kshook-as-without-intent";
import NullLR2HookFailedBPs from "./migrations/null-lr2hook-failed-bps";
import RemoveAbove100pc from "./migrations/remove-above-100pc";
import RemoveIIDXBeginners from "./migrations/remove-iidx-beginners";
import RemoveIIDX2dxtraBeginners from "./migrations/remove-iidx-extra-beginners";
import RemoveMultifolderStats from "./migrations/remove-multifolder-stats";
Expand Down Expand Up @@ -74,7 +75,12 @@ if (Environment.nodeEnv !== "test") {

// bokutachi specific migrations
if (TachiConfig.TYPE !== "kamai") {
REGISTERED_MIGRATIONS.push(NullLR2HookFailedBPs, FixUndefinedBMSData, RemoveRandom);
REGISTERED_MIGRATIONS.push(
NullLR2HookFailedBPs,
FixUndefinedBMSData,
RemoveRandom,
RemoveAbove100pc
);
}
}

Expand Down
20 changes: 20 additions & 0 deletions server/src/lib/migration/migrations/remove-above-100pc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import db from "external/mongo/db";
import { DeleteMultipleScores } from "lib/score-mutation/delete-scores";
import type { Migration } from "utils/types";

const migration: Migration = {
id: "remove-above-100pc",
up: async () => {
const toDelete = await db.scores.find({
game: "bms",
"scoreData.percent": { $gt: 100.0 },
});

await DeleteMultipleScores(toDelete);
},
down: () => {
throw new Error(`Reverting this change is not possible.`);
},
};

export default migration;

0 comments on commit e4e62e3

Please sign in to comment.