I remembered to run tests

This commit is contained in:
nairobi
2026-05-18 22:54:34 +02:00
parent 3b576b8aac
commit bba42e3d5c
9 changed files with 9588 additions and 9383 deletions
+7812 -7812
View File
File diff suppressed because it is too large Load Diff
+15 -4
View File
@@ -43,6 +43,17 @@
"versionFilter": ["mobile"],
"where": "chart.level = '11'"
},
{
"game": "arcaea",
"id": "F19e3cdc05007035d8d0",
"inactive": false,
"legacyFolderID": "Ffe7f2dc36cbcc0e0880fff765f4e580f877af220b63e441d0eb661e92411fd19",
"searchTerms": [],
"slug": "11p-mobile",
"title": "Level 11+ (Mobile)",
"versionFilter": ["mobile"],
"where": "chart.level = '11+'"
},
{
"game": "arcaea",
"id": "F19d35f0cf25b7ac2d8b",
@@ -122,9 +133,9 @@
},
{
"game": "arcaea",
"id": "F19e3c01575ffb2191d9",
"id": "F19e3cc9eccdc9552061",
"inactive": false,
"legacyFolderID": "",
"legacyFolderID": "Fe247b9ea00af9c1ea12f24d0b10e949b454a8eb2df5ec3c9f55f789569a868c7",
"searchTerms": [],
"slug": "7p-mobile",
"title": "Level 7+ (Mobile)",
@@ -144,9 +155,9 @@
},
{
"game": "arcaea",
"id": "F19e3c01575f43835f33",
"id": "F19e3cc9eccd254cfb80",
"inactive": false,
"legacyFolderID": "",
"legacyFolderID": "Ff348f630a49f29d3a694d85efdc4a36f53d63877ea512935925aaf4d1a3188dc",
"searchTerms": [],
"slug": "8p-mobile",
"title": "Level 8+ (Mobile)",
+1738 -1558
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -18,6 +18,7 @@
"10-mobile",
"10p-mobile",
"11-mobile",
"11p-mobile",
"12-mobile"
],
"game": "arcaea",
@@ -16,6 +16,7 @@ const ARCAEA_DIFFICULTY_COLORS: GPTClientImplementation<
Past: COLOUR_SET.paleBlue,
Present: COLOUR_SET.paleGreen,
Future: COLOUR_SET.purple,
Eternal: COLOUR_SET.palePurple,
Beyond: COLOUR_SET.vibrantRed,
};
@@ -101,11 +101,12 @@ export const GAME_ARCAEA_CONF = {
difficulties: {
type: "FIXED",
order: ["Past", "Present", "Future", "Beyond"],
order: ["Past", "Present", "Future", "Eternal", "Beyond"],
formatShort: {
Past: "PST",
Present: "PRS",
Future: "FTR",
Eternal: "ETR",
Beyond: "BYD",
},
formatLong: {},
@@ -7,9 +7,11 @@ import {
type integer,
type SongDocument,
} from "tachi-common";
import crypto from "crypto";
import {
CreateChartID,
CreateSongID,
GetFreshSongIDGenerator,
ReadCollection,
WriteCollection,
@@ -40,6 +42,7 @@ interface SonglistEntry {
search_artist?: LocalizedSearchTerms;
version: string;
difficulties: Array<SonglistChart>;
deleted?: boolean
}
interface PacklistEntry {
@@ -100,6 +103,8 @@ function convertDifficulty(input: integer): Difficulties["arcaea"] {
return "Future";
case 3:
return "Beyond";
case 4:
return "Eternal";
}
throw new Error(
@@ -158,9 +163,9 @@ const inGameIDToSongsMap: MultiMapUniqueValues<
const existingCharts: Map<string, ChartDocument<"arcaea">> = new Map();
for (const chart of existingChartDocs) {
const song = existingSongDocsById.get(chart.song.id);
const song = existingSongDocsById.get(chart.songID);
if (!song) {
console.warn(`Chart ${chart.song.id} does not belong to any song?`);
console.warn(`Chart ${chart.songID} does not belong to any song?`);
continue;
}
inGameIDToSongsMap.set(chart.data.inGameStrID, song);
@@ -173,6 +178,9 @@ const newSongs: Array<SongDocument<"arcaea">> = [];
const newCharts: Array<ChartDocument<"arcaea">> = [];
for (const entry of data.songs) {
if(entry.deleted) {
continue;
}
const inGameID = entry.id;
let possibleSongs = inGameIDToSongsMap.get(inGameID);
@@ -195,7 +203,8 @@ for (const entry of data.songs) {
artist: entry.artist,
altTitles,
searchTerms,
id: getNewSongID(),
id: CreateSongID(),
legacySongID: getNewSongID(),
data: {
displayVersion: entry.version,
songPack: convertPackName(packsByID, entry.set),
@@ -247,7 +256,8 @@ for (const entry of data.songs) {
artist: chart.artist ?? entry.artist,
altTitles,
searchTerms,
id: getNewSongID(),
id: CreateSongID(),
legacySongID: getNewSongID(),
data: {
displayVersion: chart.version ?? entry.version,
songPack: convertPackName(packsByID, entry.set),
@@ -270,15 +280,14 @@ for (const entry of data.songs) {
}
const chartDoc: ChartDocument<"arcaea"> = {
game: "arcaea",
chartID: CreateChartID(),
id: CreateChartID(),
songID: song.id,
legacyChartID: crypto.randomBytes(20).toString("hex"),
difficulty,
isPrimary: true,
level: `${chart.rating}${chart.ratingPlus ? "+" : ""}`,
levelNum: chart.rating + (chart.ratingPlus ? 0.7 : 0),
versions: ["mobile"],
playtype: "Touch",
data: {
inGameStrID: inGameID,
// Filled in later, but not by this script
@@ -1,3 +1,4 @@
import crypto from "crypto";
import { log as logger } from "../log.ts";
import { CreateFolderID, MutateCollection } from "../util.js";
@@ -7,6 +8,7 @@ MutateCollection("folders.json", (folders) => {
for (const folder of folders) {
if(folder.id === undefined || !folder.id.startsWith("F")) {
folder.id = CreateFolderID();
folder.legacyFolderID = `F${crypto.randomBytes(32).toString("hex")}`;
logger.info(`Updating ${folder.slug}`);
}
}
+1 -1
View File
@@ -131,7 +131,7 @@ function GetSongCollectionGameGroup(filename) {
export function GetFreshSongIDGenerator(gameGroup) {
const existing = ReadCollection(`songs-${gameGroup}.json`);
let max = existing.reduce((acc, s) => Math.max(acc, s.id ?? 0), 0);
let max = existing.reduce((acc, s) => Math.max(acc, s.legacySongID ?? 0), 0);
return () => ++max;
}