fix: kshook scores shouldn't be marked with user intent

This commit is contained in:
zkldi
2022-11-06 02:38:06 +00:00
parent 2a71641f9e
commit 5830b67922
4 changed files with 29 additions and 3 deletions
+3 -1
View File
@@ -4,6 +4,7 @@ import FixUndefinedBMSData from "./migrations/fix-undefined-bms-data";
import JoinINFCastHourCharts from "./migrations/join-inf-casthour-charts";
import JoinINFCastHourSongs from "./migrations/join-inf-casthour-songs";
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 RecalcBrokenIIDXNotecounts from "./migrations/recalc-broken-iidx-notecounts";
import RemoveIIDXBeginners from "./migrations/remove-iidx-beginners";
@@ -45,7 +46,8 @@ if (Environment.nodeEnv !== "test") {
UpdateJubeatPreferredTables,
JoinINFCastHourCharts,
JoinINFCastHourSongs,
MarkFervidexAsWithoutIntent
MarkFervidexAsWithoutIntent,
MarkKsHookAsWithoutIntent
);
}
@@ -0,0 +1,21 @@
import db from "external/mongo/db";
import type { Migration } from "utils/types";
const migration: Migration = {
id: "mark-fervidex-as-without-intent",
up: async () => {
await db.imports.update(
{
importType: { $in: ["ir/kshook-sv6c", "ir/kshook-sv6c-static"] },
},
{
userIntent: false,
}
);
},
down: () => {
throw new Error(`Unable to revert transaction.`);
},
};
export default migration;
@@ -27,6 +27,8 @@ t.test("POST /ir/kshook/sv6c/score/save", (t) => {
t.equal(res.body.body.scoreIDs.length, 1, "Should import one score.");
t.equal(res.body.body.errors.length, 0, "Should have 0 failed scores.");
t.equal(res.body.body.userIntent, false, "Should not have user intent.");
t.end();
});
@@ -117,6 +119,7 @@ t.test("POST /ir/kshook/sv6c/score/export", (t) => {
t.equal(res.body.success, true);
t.equal(res.body.body.scoreIDs.length, 1, "Should import one score.");
t.equal(res.body.body.errors.length, 0, "Should have 0 failed scores.");
t.equal(res.body.body.userIntent, false, "Should not have user intent.");
const dbRes = await db["kshook-sv6c-settings"].findOne({
userID: 1,
@@ -83,7 +83,7 @@ router.use(ValidateHeaders);
router.post("/score/save", async (req, res) => {
const responseData = await ExpressWrappedScoreImportMain(
req[SYMBOL_TACHI_API_AUTH].userID!,
true,
false,
"ir/kshook-sv6c",
[req.safeBody]
);
@@ -127,7 +127,7 @@ router.post("/score/export", async (req, res) => {
const responseData = await ExpressWrappedScoreImportMain(
userID,
true,
false,
"ir/kshook-sv6c-static",
[req.safeBody]
);