diff --git a/apps/backend-e2e/src/admin.e2e-spec.ts b/apps/backend-e2e/src/admin.e2e-spec.ts index 82dec8f8e..6f7638b3f 100644 --- a/apps/backend-e2e/src/admin.e2e-spec.ts +++ b/apps/backend-e2e/src/admin.e2e-spec.ts @@ -630,7 +630,7 @@ describe('Admin', () => { create: { mapID: map.id, gamemode: Gamemode.AHOP, - trackNum: 1, + trackNum: 2, trackType: TrackType.MAIN } } @@ -966,7 +966,7 @@ describe('Admin', () => { { gamemode: Gamemode.RJ, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, tier: 1, type: LeaderboardType.IN_SUBMISSION } @@ -1016,7 +1016,7 @@ describe('Admin', () => { { gamemode: Gamemode.RJ, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, tier: 5, type: LeaderboardType.UNRANKED } @@ -1042,7 +1042,7 @@ describe('Admin', () => { submission: { suggestions: [ { - trackNum: 0, + trackNum: 1, trackType: TrackType.MAIN, gamemode: Gamemode.RJ, tier: 1, @@ -1077,7 +1077,7 @@ describe('Admin', () => { { gamemode: Gamemode.RJ, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, tier: 5, type: LeaderboardType.UNRANKED } @@ -1126,7 +1126,7 @@ describe('Admin', () => { { gamemode: Gamemode.RJ, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, tier: 5, type: LeaderboardType.UNRANKED } @@ -1150,7 +1150,7 @@ describe('Admin', () => { name: 'surf_asbestos', suggestions: [ { - trackNum: 0, + trackNum: 1, trackType: TrackType.MAIN, gamemode: Gamemode.BHOP, tier: 1, @@ -1248,7 +1248,7 @@ describe('Admin', () => { ? [ { gamemode: Gamemode.RJ, - trackNum: 0, + trackNum: 1, trackType: 0, tier: 1, type: LeaderboardType.RANKED @@ -1328,7 +1328,7 @@ describe('Admin', () => { finalLeaderboards: [ { gamemode: Gamemode.RJ, - trackNum: 0, + trackNum: 1, trackType: 0, tier: 1, type: LeaderboardType.RANKED @@ -1390,7 +1390,7 @@ describe('Admin', () => { { gamemode: Gamemode.RJ, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, tier: 1, type: LeaderboardType.UNRANKED } @@ -1421,21 +1421,21 @@ describe('Admin', () => { { gamemode: Gamemode.RJ, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, tier: 5, type: LeaderboardType.UNRANKED }, { gamemode: Gamemode.DEFRAG_VQ3, trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, tier: 5, type: LeaderboardType.RANKED }, { gamemode: Gamemode.DEFRAG_CPM, trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, type: LeaderboardType.HIDDEN } ]; @@ -1561,7 +1561,7 @@ describe('Admin', () => { rank: 1, gamemode: Gamemode.RJ, trackType: TrackType.MAIN, - trackNum: 0 + trackNum: 1 }); await db.createLbRun({ @@ -1570,7 +1570,7 @@ describe('Admin', () => { rank: 1, gamemode: Gamemode.CONC, trackType: TrackType.MAIN, - trackNum: 0 + trackNum: 1 }); expect( @@ -1601,7 +1601,7 @@ describe('Admin', () => { mapID: map.id, gamemode: Gamemode.RJ, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, linear: false, style: 0, tier: 5, @@ -1612,7 +1612,7 @@ describe('Admin', () => { mapID: map.id, gamemode: Gamemode.RJ, trackType: TrackType.STAGE, - trackNum: 0, + trackNum: 1, linear: null, tier: null, type: LeaderboardType.UNRANKED, @@ -1623,7 +1623,7 @@ describe('Admin', () => { mapID: map.id, gamemode: Gamemode.RJ, trackType: TrackType.STAGE, - trackNum: 1, + trackNum: 2, linear: null, tier: null, type: LeaderboardType.UNRANKED, @@ -1634,7 +1634,7 @@ describe('Admin', () => { mapID: map.id, gamemode: Gamemode.DEFRAG_VQ3, trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, linear: null, tier: 5, type: LeaderboardType.RANKED, @@ -1645,7 +1645,7 @@ describe('Admin', () => { mapID: map.id, gamemode: Gamemode.DEFRAG_CPM, trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, linear: null, tier: null, type: LeaderboardType.HIDDEN, @@ -2032,7 +2032,7 @@ describe('Admin', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, tier: 10, gameplayRating: 1 @@ -2137,7 +2137,7 @@ describe('Admin', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, tier: 10, gameplayRating: 1 diff --git a/apps/backend-e2e/src/map-review.e2e-spec.ts b/apps/backend-e2e/src/map-review.e2e-spec.ts index 0f95bf17f..e8e00ad00 100644 --- a/apps/backend-e2e/src/map-review.e2e-spec.ts +++ b/apps/backend-e2e/src/map-review.e2e-spec.ts @@ -57,7 +57,7 @@ describe('Map Reviews', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.RJ, tier: 2, comment: 'True', @@ -156,7 +156,7 @@ describe('Map Reviews', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, tier: 10, gameplayRating: 1 @@ -189,7 +189,7 @@ describe('Map Reviews', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, tier: 1, gameplayRating: 10 @@ -211,7 +211,7 @@ describe('Map Reviews', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 1, + trackNum: 2, gamemode: Gamemode.DEFRAG_CPM, tier: 1, gameplayRating: 10 diff --git a/apps/backend-e2e/src/maps-2.e2e-spec.ts b/apps/backend-e2e/src/maps-2.e2e-spec.ts index f4b3e2c8d..4cc722518 100644 --- a/apps/backend-e2e/src/maps-2.e2e-spec.ts +++ b/apps/backend-e2e/src/maps-2.e2e-spec.ts @@ -1611,7 +1611,7 @@ describe('Maps Part 2', () => { user, rank: 1, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0, gamemode: Gamemode.AHOP }); @@ -1631,7 +1631,7 @@ describe('Maps Part 2', () => { leaderboard: { trackType, trackNum }, totalRuns } of res.body) { - if (trackType === TrackType.MAIN && trackNum === 0) { + if (trackType === TrackType.MAIN && trackNum === 1) { expect(totalRuns).toBe(1); } else { expect(totalRuns).toBe(0); @@ -1662,7 +1662,7 @@ describe('Maps Part 2', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.SURF, tier: 2, comment: 'What', @@ -1683,7 +1683,7 @@ describe('Maps Part 2', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.SURF, tier: 9, comment: 'The second ramp gave me cholera', @@ -1910,7 +1910,7 @@ describe('Maps Part 2', () => { { gamemode: Gamemode.AHOP, trackType: 0, - trackNum: 0, + trackNum: 1, tier: 1, gameplayRating: 1 } @@ -1955,7 +1955,7 @@ describe('Maps Part 2', () => { { gamemode: Gamemode.AHOP, trackType: 0, - trackNum: 0, + trackNum: 1, tier: 1, gameplayRating: 1 } @@ -1977,7 +1977,7 @@ describe('Maps Part 2', () => { { gamemode: Gamemode.AHOP, trackType: 0, - trackNum: 0, + trackNum: 1, tier: 1, gameplayRating: 1 } diff --git a/apps/backend-e2e/src/maps.e2e-spec.ts b/apps/backend-e2e/src/maps.e2e-spec.ts index b26a3255f..f4f026ddd 100644 --- a/apps/backend-e2e/src/maps.e2e-spec.ts +++ b/apps/backend-e2e/src/maps.e2e-spec.ts @@ -231,7 +231,7 @@ describe('Maps', () => { create: { gamemode, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0, type: LeaderboardType.RANKED } @@ -247,14 +247,14 @@ describe('Maps', () => { { gamemode, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0, type: LeaderboardType.HIDDEN }, { gamemode: Gamemode.RJ, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0, type: LeaderboardType.RANKED } @@ -590,7 +590,7 @@ describe('Maps', () => { gamemode: Gamemode.RJ, type: LeaderboardType.RANKED, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0, runs: { create: { userID: u1.id, rank: 1, time: 1, stats: {} } } } @@ -602,7 +602,7 @@ describe('Maps', () => { gamemode: Gamemode.SJ, type: LeaderboardType.RANKED, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0, runs: { create: { userID: u1.id, rank: 1, time: 1, stats: {} } } } @@ -640,7 +640,7 @@ describe('Maps', () => { gamemode: Gamemode.RJ, type: LeaderboardType.RANKED, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0, runs: { create: { userID: u1.id, rank: 1, time: 1, stats: {} } } } @@ -652,7 +652,7 @@ describe('Maps', () => { gamemode: Gamemode.SJ, type: LeaderboardType.RANKED, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0, runs: { create: { userID: u1.id, rank: 1, time: 1, stats: {} } } } @@ -735,7 +735,7 @@ describe('Maps', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.RJ, tier: 1, type: LeaderboardType.RANKED, @@ -743,7 +743,7 @@ describe('Maps', () => { }, { trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, tier: 2, type: LeaderboardType.RANKED, @@ -828,7 +828,7 @@ describe('Maps', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.RJ, tier: 1, type: LeaderboardType.RANKED, @@ -836,7 +836,7 @@ describe('Maps', () => { }, { trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, tier: 2, type: LeaderboardType.RANKED, @@ -1377,12 +1377,12 @@ describe('Maps', () => { suggs.push( { gamemode: Gamemode.SURF, - trackNum: 0, + trackNum: 1, trackType: TrackType.MAIN }, { gamemode: Gamemode.BHOP, - trackNum: 0, + trackNum: 1, trackType: TrackType.MAIN } ); @@ -1464,7 +1464,7 @@ describe('Maps', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.SURF, tier: 1, type: LeaderboardType.RANKED, @@ -1756,7 +1756,7 @@ describe('Maps', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.RJ, tier: 10, type: LeaderboardType.RANKED @@ -1883,7 +1883,7 @@ describe('Maps', () => { rank: 1, gamemode: Gamemode.RJ, trackType: TrackType.MAIN, - trackNum: 0 + trackNum: 1 }); await db.createLbRun({ @@ -1892,7 +1892,7 @@ describe('Maps', () => { rank: 1, gamemode: Gamemode.CONC, trackType: TrackType.BONUS, - trackNum: 0 + trackNum: 1 }); expect( @@ -1944,10 +1944,10 @@ describe('Maps', () => { // prettier-ignore const expected = [GM.RJ, GM.SJ, GM.CONC, GM.DEFRAG_CPM, GM.DEFRAG_VQ3, GM.DEFRAG_VTG] .flatMap((gamemode) => [ - { gamemode, trackType: TrackType.MAIN, trackNum: 0, linear: false }, - { gamemode, trackType: TrackType.STAGE, trackNum: 0, linear: null }, + { gamemode, trackType: TrackType.MAIN, trackNum: 1, linear: false }, { gamemode, trackType: TrackType.STAGE, trackNum: 1, linear: null }, - { gamemode, trackType: TrackType.STAGE, trackNum: 2, linear: null } + { gamemode, trackType: TrackType.STAGE, trackNum: 2, linear: null }, + { gamemode, trackType: TrackType.STAGE, trackNum: 3, linear: null } ]); const leaderboards = await prisma.leaderboard.findMany({ @@ -2249,7 +2249,7 @@ describe('Maps', () => { mmap: { connect: { id: map.id } }, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0, type: LeaderboardType.IN_SUBMISSION, runs: { @@ -2292,7 +2292,7 @@ describe('Maps', () => { mmap: { connect: { id: map.id } }, gamemode: Gamemode.RJ, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0, type: LeaderboardType.IN_SUBMISSION, runs: { @@ -2373,7 +2373,7 @@ describe('Maps', () => { mmap: { connect: { id: map.id } }, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0, type: LeaderboardType.IN_SUBMISSION, runs: { @@ -2443,14 +2443,14 @@ describe('Maps', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.RJ, tier: 1, type: LeaderboardType.RANKED }, { trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, tier: 1, type: LeaderboardType.UNRANKED @@ -2492,14 +2492,14 @@ describe('Maps', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.CONC, tier: 1, type: LeaderboardType.RANKED }, { trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, tier: 1, type: LeaderboardType.UNRANKED @@ -2527,14 +2527,14 @@ describe('Maps', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.CONC, tier: 1, type: LeaderboardType.RANKED }, { trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, tier: 1, type: LeaderboardType.UNRANKED @@ -2604,14 +2604,14 @@ describe('Maps', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.CONC, tier: 1, rtype: LeaderboardType.RANKED }, { trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, tier: 1, type: LeaderboardType.RANKED @@ -2667,14 +2667,14 @@ describe('Maps', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, tier: 10, type: LeaderboardType.RANKED }, { trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, tier: 1, type: LeaderboardType.RANKED @@ -2720,14 +2720,14 @@ describe('Maps', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, tier: 10, type: LeaderboardType.RANKED }, { trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, tier: 1, type: LeaderboardType.RANKED @@ -2769,14 +2769,14 @@ describe('Maps', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, tier: 10, type: LeaderboardType.RANKED }, { trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, tier: 1, type: LeaderboardType.RANKED @@ -2853,14 +2853,14 @@ describe('Maps', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, tier: 10, type: LeaderboardType.RANKED }, { trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, tier: 1, type: LeaderboardType.RANKED @@ -2984,7 +2984,7 @@ describe('Maps', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, comment: 'FUCK!!!!', tier: 10, @@ -3002,7 +3002,7 @@ describe('Maps', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, comment: 'FUCK!!!!', tier: 10, @@ -3010,7 +3010,7 @@ describe('Maps', () => { }, { trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.DEFRAG_CPM, tier: 1, type: LeaderboardType.IN_SUBMISSION @@ -3040,7 +3040,7 @@ describe('Maps', () => { suggestions: [ { trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.SURF, tier: 10, type: LeaderboardType.RANKED @@ -3134,7 +3134,7 @@ describe('Maps', () => { { track: 1, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.CONC, tier: 1, type: LeaderboardType.RANKED, diff --git a/apps/backend-e2e/src/multi-stage.e2e-spec.ts b/apps/backend-e2e/src/multi-stage.e2e-spec.ts index cce1aa5fb..30cc17923 100644 --- a/apps/backend-e2e/src/multi-stage.e2e-spec.ts +++ b/apps/backend-e2e/src/multi-stage.e2e-spec.ts @@ -92,7 +92,7 @@ describe('Multi-stage E2E tests', () => { { gamemode: Gamemode.SURF, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, tier: 1, type: LeaderboardType.RANKED } @@ -123,7 +123,7 @@ describe('Multi-stage E2E tests', () => { expect.objectContaining({ gamemode: Gamemode.SURF, trackType: TrackType.MAIN, - trackNum: 0 + trackNum: 1 }) ]) ); @@ -220,7 +220,7 @@ describe('Multi-stage E2E tests', () => { { gamemode: Gamemode.BHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, tier: 10, type: LeaderboardType.UNRANKED } @@ -255,7 +255,7 @@ describe('Multi-stage E2E tests', () => { { gamemode: Gamemode.BHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, linear: true, style: 0, tier: 10, diff --git a/apps/backend-e2e/src/session.e2e-spec.ts b/apps/backend-e2e/src/session.e2e-spec.ts index 9b815a6d5..8b7b9a89b 100644 --- a/apps/backend-e2e/src/session.e2e-spec.ts +++ b/apps/backend-e2e/src/session.e2e-spec.ts @@ -66,10 +66,10 @@ describe('Session', () => { it('should return a valid run DTO', async () => { for (const [trackType, trackNum] of [ - [TrackType.MAIN, 0], - [TrackType.STAGE, 0], + [TrackType.MAIN, 1], [TrackType.STAGE, 1], - [TrackType.BONUS, 0] + [TrackType.STAGE, 2], + [TrackType.BONUS, 1] ]) { const res = await req.post({ url: 'session/run', @@ -105,7 +105,7 @@ describe('Session', () => { mapID: otherMap.id, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0 + trackNum: 1 } }); @@ -116,7 +116,7 @@ describe('Session', () => { mapID: map.id, gamemode: Gamemode.BHOP, trackType: TrackType.MAIN, - trackNum: 0 + trackNum: 1 } }); @@ -127,7 +127,7 @@ describe('Session', () => { mapID: map.id, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0 + trackNum: 1 } }); @@ -139,7 +139,7 @@ describe('Session', () => { mapID: map.id, gamemode: Gamemode.AHOP, trackType: TrackType.STAGE, - trackNum: 0, + trackNum: 1, segment: 0 } }); @@ -152,14 +152,14 @@ describe('Session', () => { mapID: map.id, trackType: TrackType.MAIN, gamemode: Gamemode.AHOP, - trackNum: 0 + trackNum: 1 }), expect.objectContaining({ userID: user.id, mapID: map.id, trackType: TrackType.STAGE, gamemode: Gamemode.AHOP, - trackNum: 0 + trackNum: 1 }) ]); }); @@ -173,9 +173,12 @@ describe('Session', () => { it('should 400 if the map does not have leaderboards for given trackType/Num', async () => { for (const [trackType, trackNum] of [ - [TrackType.MAIN, 1], - [TrackType.STAGE, 2], - [TrackType.BONUS, 1] + [TrackType.MAIN, 0], + [TrackType.MAIN, 2], + [TrackType.STAGE, 0], + [TrackType.STAGE, 3], + [TrackType.BONUS, 0], + [TrackType.BONUS, 2] ]) { await req.post({ url: 'session/run', @@ -199,7 +202,7 @@ describe('Session', () => { body: { mapID: NULL_ID, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, segment: 0 }, @@ -213,7 +216,7 @@ describe('Session', () => { body: { mapID: NULL_ID, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.BHOP, segment: 0 }, @@ -228,7 +231,7 @@ describe('Session', () => { mapID: map.id, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, segment: 0 } })); @@ -243,7 +246,7 @@ describe('Session', () => { mapID: map.id, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, segment: 0, checkpoint: 0 }, @@ -290,7 +293,7 @@ describe('Session', () => { userID: u1.id, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, mapID: map.id } }); @@ -300,7 +303,7 @@ describe('Session', () => { userID: u1.id, gamemode: Gamemode.AHOP, trackType: TrackType.STAGE, - trackNum: 0, + trackNum: 1, mapID: map.id } }); @@ -384,7 +387,7 @@ describe('Session', () => { mapID: map.id, trackType: TrackType.MAIN, gamemode: Gamemode.AHOP, - trackNum: 0 + trackNum: 1 } }); }); @@ -466,7 +469,7 @@ describe('Session', () => { mapID: map.id, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0 + trackNum: 1 } }); @@ -474,7 +477,7 @@ describe('Session', () => { token, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, runDate: Date.now().toString(), runFlags: 0, mapID: map.id, @@ -505,7 +508,7 @@ describe('Session', () => { mapID: map.id, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0 } } @@ -516,7 +519,7 @@ describe('Session', () => { mmap: { connect: { id: map.id } }, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0, time: i } @@ -600,7 +603,7 @@ describe('Session', () => { mapID: map.id, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0 } }); @@ -614,7 +617,7 @@ describe('Session', () => { mapID: map.id, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0 } }); @@ -639,7 +642,7 @@ describe('Session', () => { mapID: map.id, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0, rank: 4 }, @@ -651,7 +654,7 @@ describe('Session', () => { mapID: map.id, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0 } }); @@ -669,7 +672,7 @@ describe('Session', () => { mapID: map.id, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0 } }); @@ -705,7 +708,7 @@ describe('Session', () => { mapID: map.id, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0, rank: 1 }, @@ -717,7 +720,7 @@ describe('Session', () => { mapID: map.id, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0 } }); @@ -736,7 +739,7 @@ describe('Session', () => { mapID: map.id, gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0 } }); diff --git a/apps/backend-e2e/src/user.e2e-spec.ts b/apps/backend-e2e/src/user.e2e-spec.ts index 334de6bd5..d07997c8e 100644 --- a/apps/backend-e2e/src/user.e2e-spec.ts +++ b/apps/backend-e2e/src/user.e2e-spec.ts @@ -459,7 +459,7 @@ describe('User', () => { await db.createPastRun({ map, user, - trackNum: 0, + trackNum: 1, trackType: TrackType.MAIN, lbRank: 1, createLbRun: true, @@ -1730,136 +1730,3 @@ describe('User', () => { }); }); }); - -/* - * Some lengthy tests we could port later, probably near the end of - * porting, once the activities/notifications system is implemented. - * it('should respond with notification data', async () => { - - // testUser follows testUser2 - const res1 = await serv - .post('/api/user/follow') - .set('Authorization', 'Bearer ' + global.accessToken) - .send({ - userID: user2.id - }) - .expect(200); - - // changes the follow relationship between testUser and testUser2 to notify when a map is approved - const res2 = await serv - .patch('/api/user/follow/' + user2.id) - .set('Authorization', 'Bearer ' + global.accessToken) - .send({ - notifyOn: 1 << activity.ACTIVITY_TYPES.MAP_APPROVED - }) - .expect(204); - - // testUser2 creates a map - const res3 = await serv - .post('/api/maps') - .set('Authorization', 'Bearer ' + global.accessToken2) - .send({ - name: 'test_map_notif', - type: EMapType.SURF, - info: { - description: 'newmap_5', - numTracks: 1, - creationDate: new Date() - }, - tracks: [ - { - trackNum: 0, - numZones: 1, - isLinear: false, - difficulty: 5 - } - ], - credits: [ - { - userID: user2.id, - type: EMapCreditType.AUTHOR - } - ] - }) - .expect(200); - - // upload the map - const res4 = await serv - .post(new URL(res3.header.location).pathname) - .set('Authorization', 'Bearer ' + global.accessToken2) - * .attach('mapFile', fs.readFileSync('test/testMap.bsp'), - * 'testMap.bsp') .status(200); - - // testadmin approves the map - const res5 = await serv - .patch('/api/admin/maps/' + res3.body.id) - .set('Authorization', 'Bearer ' + adminAccessToken) - .send({ status: EMapStatus.APPROVED }) - .status(204); - - // should get the notification that testUser2's map was approved - const res6 = await serv - .get('/api/user/notifications') - .set('Authorization', 'Bearer ' + global.accessToken) - .expect(200); - - expect(res6.body).toHaveProperty('notifications'); - expect(Array.isArray(res6.body.notifications)).toBe(true); - expect(res6.body.notifications).toHaveLength(1); - - serv.close(); - }); - */ - -// Commented out until the 0.10.0 replay refactor -/*it.skip('should respond with notification data for map notifications', () => {}); - () => { - // enable map notifications for the given map - const res = await request(global.server) - .put('/api/user/notifyMap/' + testMap.id) - .set('Authorization', 'Bearer ' + global.accessToken) - .send({ - notifyOn: activity.ACTIVITY_TYPES.WR_ACHIEVED - }) - .then(res => { - // upload a run session - const res = await request(global.server) - .post(`/api/maps/${testMap.id}/session`) - .set('Authorization', 'Bearer ' + adminGameAccessToken) - .send({ - trackNum: 0, - zoneNum: 0, - }) - .then(res2 => { - // update the run session - let sesID = res2.body.id; - const res = await request(global.server) - .post(`/api/maps/${testMap.id}/session/${sesID}`) - * .set('Authorization', 'Bearer ' + - * adminGameAccessToken) .send({ - zoneNum: 2, - tick: 510, - }) - .then(res3 => { - // end the run session - const res = await request(global.server) - .post(`/api/maps/${testMap.id}/session/1/end`) - * .set('Authorization', 'Bearer ' + - * adminGameAccessToken) .set('Content-Type', - * 'application/octet-stream') .send( - fs.readFileSync('test/testRun.momrec') - ) - .then(res4 => { - expect(res2).to.have.status(200); - expect(res2).to.be.json; - expect(res2.body).to.have.property('id'); - expect(res3).to.have.status(200); - expect(res3).to.be.json; - expect(res3.body).to.have.property('id'); - expect(res4).to.have.status(200); - }) - }); - }); - }); - }); -*/ diff --git a/apps/backend/src/app/dto/map/map-review-suggestions.dto.ts b/apps/backend/src/app/dto/map/map-review-suggestions.dto.ts index 9cf7646dd..b631bd6bd 100644 --- a/apps/backend/src/app/dto/map/map-review-suggestions.dto.ts +++ b/apps/backend/src/app/dto/map/map-review-suggestions.dto.ts @@ -6,6 +6,7 @@ import { EnumProperty } from '../decorators'; export class MapReviewSuggestionDto implements MapReviewSuggestion { @ApiProperty({ description: 'Track number the suggestion refers to' }) @IsInt() + @Min(1) readonly trackNum: number; @ApiProperty({ description: 'Track type the suggestion refers to' }) diff --git a/apps/backend/src/app/dto/map/map-submission-approval.dto.ts b/apps/backend/src/app/dto/map/map-submission-approval.dto.ts index 6fa9f732f..068dffc97 100644 --- a/apps/backend/src/app/dto/map/map-submission-approval.dto.ts +++ b/apps/backend/src/app/dto/map/map-submission-approval.dto.ts @@ -14,6 +14,7 @@ export class MapSubmissionApprovalDto implements MapSubmissionApproval { @ApiProperty({ description: 'Track number the suggestion refers to' }) @IsInt() + @Min(1) readonly trackNum: number; @EnumProperty(TrackType, { diff --git a/apps/backend/src/app/dto/map/map-submission-suggestion.dto.ts b/apps/backend/src/app/dto/map/map-submission-suggestion.dto.ts index b23cecb97..cff6cca9c 100644 --- a/apps/backend/src/app/dto/map/map-submission-suggestion.dto.ts +++ b/apps/backend/src/app/dto/map/map-submission-suggestion.dto.ts @@ -22,6 +22,7 @@ export class MapSubmissionSuggestionDto implements MapSubmissionSuggestion { @ApiProperty({ description: 'Track number the suggestion refers to' }) @IsInt() + @Min(1) readonly trackNum: number; @EnumProperty(TrackType, { diff --git a/apps/backend/src/app/dto/queries/map-queries.dto.ts b/apps/backend/src/app/dto/queries/map-queries.dto.ts index c2785dd34..1052302a3 100644 --- a/apps/backend/src/app/dto/queries/map-queries.dto.ts +++ b/apps/backend/src/app/dto/queries/map-queries.dto.ts @@ -207,7 +207,7 @@ export class MapLeaderboardGetQueryDto trackType = TrackType.MAIN; @IntQueryProperty({ required: false }) - trackNum = 0; + trackNum = 1; @EnumQueryProperty(Style, { required: false }) style = Style.NONE; @@ -243,7 +243,7 @@ export class MapLeaderboardGetRunQueryDto trackType = TrackType.MAIN; @IntQueryProperty({ required: false }) - trackNum = 0; + trackNum = 1; @EnumQueryProperty(Style, { required: false }) style = Style.NONE; diff --git a/apps/backend/src/app/dto/run/leaderboard-run.dto.ts b/apps/backend/src/app/dto/run/leaderboard-run.dto.ts index 76da0b58f..b70ab68ff 100644 --- a/apps/backend/src/app/dto/run/leaderboard-run.dto.ts +++ b/apps/backend/src/app/dto/run/leaderboard-run.dto.ts @@ -15,7 +15,8 @@ import { IsOptional, IsPositive, IsString, - IsUrl + IsUrl, + Min } from 'class-validator'; import { Exclude, Expose, plainToInstance } from 'class-transformer'; import { MapDto } from '../map/map.dto'; @@ -44,6 +45,7 @@ export class LeaderboardRunDto implements LeaderboardRun { type: Number, description: 'The trackNum the run took place on' }) + @Min(1) readonly trackNum: number; @EnumProperty(Style, { description: 'The trackNum the run took place on' }) diff --git a/apps/backend/src/app/dto/run/leaderboard.dto.ts b/apps/backend/src/app/dto/run/leaderboard.dto.ts index 540e0054a..e49e4c416 100644 --- a/apps/backend/src/app/dto/run/leaderboard.dto.ts +++ b/apps/backend/src/app/dto/run/leaderboard.dto.ts @@ -7,7 +7,7 @@ import { TrackType } from '@momentum/constants'; import { ApiProperty } from '@nestjs/swagger'; -import { IsBoolean, IsInt, IsOptional, IsString } from 'class-validator'; +import { IsBoolean, IsInt, IsOptional, IsString, Min } from 'class-validator'; import { Exclude } from 'class-transformer'; import { EnumProperty } from '../decorators'; @@ -25,6 +25,7 @@ export class LeaderboardDto implements Leaderboard { description: 'The trackNum the run took place on' }) @IsInt() + @Min(1) readonly trackNum: number; @EnumProperty(Style, { description: 'The trackNum the run took place on' }) diff --git a/apps/backend/src/app/dto/run/past-run.dto.ts b/apps/backend/src/app/dto/run/past-run.dto.ts index 4131da871..18af8b1a2 100644 --- a/apps/backend/src/app/dto/run/past-run.dto.ts +++ b/apps/backend/src/app/dto/run/past-run.dto.ts @@ -6,7 +6,7 @@ import { TrackType } from '@momentum/constants'; import { ApiProperty } from '@nestjs/swagger'; -import { IsBoolean, IsInt, IsNumber, IsPositive } from 'class-validator'; +import { IsBoolean, IsInt, IsNumber, IsPositive, Min } from 'class-validator'; import { Exclude, Expose, plainToInstance, Type } from 'class-transformer'; import { MapDto } from '../map/map.dto'; import { UserDto } from '../user/user.dto'; @@ -34,6 +34,7 @@ export class PastRunDto implements PastRun { description: 'The trackNum the run took place on' }) @IsInt() + @Min(1) readonly trackNum: number; @EnumProperty(Style, { description: 'The trackNum the run took place on' }) diff --git a/apps/backend/src/app/dto/run/run-session.dto.ts b/apps/backend/src/app/dto/run/run-session.dto.ts index 57a7df2a9..5d48df9cc 100644 --- a/apps/backend/src/app/dto/run/run-session.dto.ts +++ b/apps/backend/src/app/dto/run/run-session.dto.ts @@ -7,7 +7,7 @@ UpdateRunSession } from '@momentum/constants'; import { ApiProperty, PickType } from '@nestjs/swagger'; -import { IsInt, IsPositive } from 'class-validator'; +import { IsInt, IsPositive, Min } from 'class-validator'; import { CreatedAtProperty, EnumProperty, IdProperty } from '../decorators'; export class RunSessionDto implements RunSession { @@ -40,6 +40,7 @@ export class RunSessionDto implements RunSession { required: true }) @IsInt() + @Min(1) readonly trackNum: number; @ApiProperty({ diff --git a/apps/backend/src/app/modules/maps/leaderboard-handler.util.spec.ts b/apps/backend/src/app/modules/maps/leaderboard-handler.util.spec.ts index 219be9ac5..fc94ab90a 100644 --- a/apps/backend/src/app/modules/maps/leaderboard-handler.util.spec.ts +++ b/apps/backend/src/app/modules/maps/leaderboard-handler.util.spec.ts @@ -22,25 +22,25 @@ describe('LeaderboardHandler', () => { const inMain = { gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0 + trackNum: 1 }; const outMain = { gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0 + trackNum: 1 }; const inBonus = { gamemode: Gamemode.BHOP, trackType: TrackType.BONUS, - trackNum: 0 + trackNum: 1 }; const outBonus = { gamemode: Gamemode.BHOP, trackType: TrackType.BONUS, - trackNum: 0 + trackNum: 1 }; expect( @@ -62,21 +62,21 @@ describe('LeaderboardHandler', () => { expect( LeaderboardHandler['getStageLeaderboards']( [ - { gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, trackNum: 0 }, + { gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, trackNum: 1 }, { gamemode: Gamemode.BHOP, trackType: TrackType.BONUS, - trackNum: 0 + trackNum: 1 }, - { gamemode: Gamemode.BHOP, trackType: TrackType.MAIN, trackNum: 0 } + { gamemode: Gamemode.BHOP, trackType: TrackType.MAIN, trackNum: 1 } ], ZonesStub ) ).toMatchObject([ - { gamemode: Gamemode.AHOP, trackType: TrackType.STAGE, trackNum: 0 }, { gamemode: Gamemode.AHOP, trackType: TrackType.STAGE, trackNum: 1 }, - { gamemode: Gamemode.BHOP, trackType: TrackType.STAGE, trackNum: 0 }, - { gamemode: Gamemode.BHOP, trackType: TrackType.STAGE, trackNum: 1 } + { gamemode: Gamemode.AHOP, trackType: TrackType.STAGE, trackNum: 2 }, + { gamemode: Gamemode.BHOP, trackType: TrackType.STAGE, trackNum: 1 }, + { gamemode: Gamemode.BHOP, trackType: TrackType.STAGE, trackNum: 2 } ]); }); @@ -85,7 +85,7 @@ describe('LeaderboardHandler', () => { zones.tracks.main.zones.segments = [zones.tracks.main.zones.segments[0]]; expect( LeaderboardHandler['getStageLeaderboards']( - [{ gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, trackNum: 0 }], + [{ gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, trackNum: 1 }], zones ) ).toEqual([]); diff --git a/apps/backend/src/app/modules/maps/leaderboard-handler.util.ts b/apps/backend/src/app/modules/maps/leaderboard-handler.util.ts index 2eb3348e5..7e5fd33e8 100644 --- a/apps/backend/src/app/modules/maps/leaderboard-handler.util.ts +++ b/apps/backend/src/app/modules/maps/leaderboard-handler.util.ts @@ -87,7 +87,7 @@ export const LeaderboardHandler = { // Whether is ranked depends on main Track, doesn't have a tier. type: (lb as T & { type?: LeaderboardType }).type, trackType: TrackType.STAGE, - trackNum: i + trackNum: i + 1 }) as unknown as T ) ), diff --git a/apps/backend/src/app/modules/maps/maps.service.ts b/apps/backend/src/app/modules/maps/maps.service.ts index 9839ea39b..da15b0163 100644 --- a/apps/backend/src/app/modules/maps/maps.service.ts +++ b/apps/backend/src/app/modules/maps/maps.service.ts @@ -474,7 +474,7 @@ export class MapsService { }; } else if (PB) { select.leaderboardRuns.where = { - trackType: TrackType.MAIN, // Probs fastest to omit trackNum here (can't be != 0) + trackType: TrackType.MAIN, // Probs fastest to omit trackNum here (can't be != 1) style: 0, userID: userID }; diff --git a/apps/backend/src/app/modules/session/run/run-processor.class.spec.ts b/apps/backend/src/app/modules/session/run/run-processor.class.spec.ts index fe2970f91..8be236ce8 100644 --- a/apps/backend/src/app/modules/session/run/run-processor.class.spec.ts +++ b/apps/backend/src/app/modules/session/run/run-processor.class.spec.ts @@ -21,7 +21,7 @@ describe('RunProcessor', () => { mapZones = zones, timestamps = [] as Array>, trackType = TrackType.MAIN, - trackNum = 0, + trackNum = 1, mapHash = '0'.repeat(40), mapName = 'GREGG_WALLACES_WORLD_OF_FUN', startTime = Date.now() - 100000 @@ -77,10 +77,19 @@ describe('RunProcessor', () => { expectFail({}); }); - it('should throw if trackNum is not 0', () => { - // TODO: should be 1 + it('should throw if trackNum is not 1', () => { expectFail({ - trackNum: 1, + trackNum: 2, + timestamps: [ + { time: 100, segment: 0, checkpoint: 0 }, + { time: 200, segment: 0, checkpoint: 1 }, + { time: 300, segment: 1, checkpoint: 0 }, + { time: 400, segment: 1, checkpoint: 1 } + ] + }); + + expectFail({ + trackNum: 0, timestamps: [ { time: 100, segment: 0, checkpoint: 0 }, { time: 200, segment: 0, checkpoint: 1 }, @@ -361,7 +370,7 @@ describe('RunProcessor', () => { it('should not throw for valid timestamps', () => { expectPass({ trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, timestamps: [ { time: 100, segment: 0, checkpoint: 0 }, { time: 200, segment: 0, checkpoint: 1 }, @@ -373,7 +382,7 @@ describe('RunProcessor', () => { it('should throw if trackNum does not match timestamp segment', () => { expectFail({ trackType: TrackType.BONUS, - trackNum: 1, + trackNum: 2, timestamps: [ { time: 100, segment: 0, checkpoint: 0 }, { time: 200, segment: 0, checkpoint: 1 }, diff --git a/apps/backend/src/app/modules/session/run/run-processor.class.ts b/apps/backend/src/app/modules/session/run/run-processor.class.ts index 2c9133606..713837379 100644 --- a/apps/backend/src/app/modules/session/run/run-processor.class.ts +++ b/apps/backend/src/app/modules/session/run/run-processor.class.ts @@ -50,7 +50,7 @@ export class RunProcessor { // // Note that that currently, the timestamps do NOT include hitting the end // zone. The game is stupid and can't send a multipart form, and needs to - // send areplay file, so we determine the final time by parsing the replay, + // send a replay file, so we determine the final time by parsing the replay, // rather than a timestamp. This will probably change in the future! if (this.timestamps.length === 0) { @@ -77,23 +77,19 @@ export class RunProcessor { throw new RunValidationError(ErrorType.BAD_TIMESTAMPS); } - // TODO: Ltos of -1s reqired in idnexes when changing trackNum to start at 1! // Stage or bonus runs if (this.trackType !== TrackType.MAIN) { // Only one segment, and must match trackType if ( - !this.timestamps.every( - ({ segment }) => segment === this.trackNum /* - 1 */ - ) + !this.timestamps.every(({ segment }) => segment === this.trackNum - 1) ) { throw new RunValidationError(ErrorType.BAD_TIMESTAMPS); } const segment = this.trackType === TrackType.STAGE - ? this.zones.tracks.main.zones.segments[this.trackNum /* - 1 */] - : this.zones.tracks.bonuses[this.trackNum /* - 1 */].zones - .segments[0]; + ? this.zones.tracks.main.zones.segments[this.trackNum - 1] + : this.zones.tracks.bonuses[this.trackNum - 1].zones.segments[0]; this.validateSegment(segment, this.timestamps); @@ -104,8 +100,8 @@ export class RunProcessor { // Segments are always ordered and required! const { zones } = this.zones.tracks.main; - // trackNum must always be 0 /* 1 */ - if (this.trackNum !== 0 /* 1 */) { + // trackNum must always be 1 + if (this.trackNum !== 1) { throw new RunValidationError(ErrorType.BAD_TIMESTAMPS); } diff --git a/apps/frontend/src/app/components/map-forms/map-leaderboard-selection/map-leaderboard-selection.component.ts b/apps/frontend/src/app/components/map-forms/map-leaderboard-selection/map-leaderboard-selection.component.ts index 8bc53fa8e..6aea89209 100644 --- a/apps/frontend/src/app/components/map-forms/map-leaderboard-selection/map-leaderboard-selection.component.ts +++ b/apps/frontend/src/app/components/map-forms/map-leaderboard-selection/map-leaderboard-selection.component.ts @@ -58,7 +58,7 @@ export class MapLeaderboardSelectionComponent implements ControlValueAccessor { this.availableBonusTracks = zones?.tracks?.bonuses?.map((_, i) => ({ label: i + 1, - value: i + value: i + 1 })) ?? []; } @@ -71,7 +71,7 @@ export class MapLeaderboardSelectionComponent implements ControlValueAccessor { ({ trackType }) => trackType === TrackType.MAIN ); - let trackNum = 0; + let trackNum = 1; let trackType: TrackType; if (!hasMainTrack) { trackType = TrackType.MAIN; @@ -84,12 +84,8 @@ export class MapLeaderboardSelectionComponent implements ControlValueAccessor { .map(({ trackNum }) => trackNum) ); - for (let i = 0; bonusNums.size < 0; i++) { - if (!bonusNums.has(i)) { - trackNum = i; - break; - } - } + trackNum = 1; + while (bonusNums.has(trackNum)) trackNum++; } this.value.push({ @@ -125,7 +121,7 @@ export class MapLeaderboardSelectionComponent implements ControlValueAccessor { // Default value with empty gamemode/track selections whilst component // is default before zone init this.value = [ - { trackNum: 0, type: LeaderboardType.UNRANKED, tier: 1 } as any + { trackNum: 1, type: LeaderboardType.UNRANKED, tier: 1 } as any ]; } else { this.value = value; diff --git a/apps/frontend/src/app/components/map-forms/map-status-form/map-final-approval-form.component.html b/apps/frontend/src/app/components/map-forms/map-status-form/map-final-approval-form.component.html index 25d7adeb1..aef3faf4e 100644 --- a/apps/frontend/src/app/components/map-forms/map-status-form/map-final-approval-form.component.html +++ b/apps/frontend/src/app/components/map-forms/map-status-form/map-final-approval-form.component.html @@ -10,7 +10,7 @@ {{ TTName.get(leaderboard.trackType) }} @if (leaderboard.trackType !== TrackType.MAIN) { - {{ leaderboard.trackNum + 1 }} + {{ leaderboard.trackNum }} } {{ leaderboard.totalRuns | plural: 'player' }} submitted runs diff --git a/apps/frontend/src/app/components/map-list/map-list-item.component.html b/apps/frontend/src/app/components/map-list/map-list-item.component.html index fbbbdb35c..5b232540c 100644 --- a/apps/frontend/src/app/components/map-list/map-list-item.component.html +++ b/apps/frontend/src/app/components/map-list/map-list-item.component.html @@ -59,7 +59,7 @@ class="h-8 drop-shadow-sm" [ngClass]="{ 'ml-auto': $first }" [mTooltip]="GamemodeInfo.get(leaderboard.gamemode).name" - [src]="'assets/images/gamemodes/ ' + GamemodeInfo.get(leaderboard.gamemode).icon" + [src]="'assets/images/gamemodes/ ' + GamemodeInfo.get(leaderboard.gamemode).icon + '.png'" /> } } diff --git a/apps/frontend/src/app/components/map-review/map-review-suggestions-form.component.ts b/apps/frontend/src/app/components/map-review/map-review-suggestions-form.component.ts index c4ca11241..fc607cde2 100644 --- a/apps/frontend/src/app/components/map-review/map-review-suggestions-form.component.ts +++ b/apps/frontend/src/app/components/map-review/map-review-suggestions-form.component.ts @@ -37,7 +37,7 @@ export class MapReviewSuggestionsFormComponent implements ControlValueAccessor { protected disabled = false; protected availableGamemodes: Array<{ gamemode: Gamemode; label: string }>; - protected availableBonusTracks: Array<{ trackNum: number; label: string }> = + protected availableBonusTracks: Array<{ trackNum: number; label: number }> = []; protected defaultMode: Gamemode; private _map: MMap; @@ -62,8 +62,8 @@ export class MapReviewSuggestionsFormComponent implements ControlValueAccessor { ( map?.zones ?? map?.submission?.currentVersion?.zones )?.tracks?.bonuses?.map((_, i) => ({ - trackNum: i, - label: (i + 1).toString() + trackNum: i + 1, + label: i + 1 })) ?? []; // Use leaderboards as this has sorting stuff for trying to determine @@ -81,7 +81,7 @@ export class MapReviewSuggestionsFormComponent implements ControlValueAccessor { ({ trackType }) => trackType === TrackType.MAIN ); - let trackNum = 0; + let trackNum = 1; let trackType: TrackType; if (!hasMainTrack) { trackType = TrackType.MAIN; @@ -94,12 +94,8 @@ export class MapReviewSuggestionsFormComponent implements ControlValueAccessor { .map(({ trackNum }) => trackNum) ); - for (let i = 0; bonusNums.size < 0; i++) { - if (!bonusNums.has(i)) { - trackNum = i; - break; - } - } + trackNum = 1; + while (bonusNums.has(trackNum)) trackNum++; } this.value.push({ diff --git a/apps/frontend/src/app/components/map-review/map-review.component.html b/apps/frontend/src/app/components/map-review/map-review.component.html index 4bc3ae6a6..a41d86945 100644 --- a/apps/frontend/src/app/components/map-review/map-review.component.html +++ b/apps/frontend/src/app/components/map-review/map-review.component.html @@ -49,7 +49,7 @@

{{ mainSugg.gameplayRating ?? '' }}

} @for (bonus of gamemode.value.get(TrackType.BONUS); track $index) { -

B{{ bonus.trackNum + 1 }}

+

B{{ bonus.trackNum }}

{{ bonus.tier ?? '' }}

{{ bonus.gameplayRating ?? '' }}

} diff --git a/apps/frontend/src/app/pages/maps/map-info/map-leaderboard/map-leaderboard.component.html b/apps/frontend/src/app/pages/maps/map-info/map-leaderboard/map-leaderboard.component.html index 376e6cdb4..0324dc065 100644 --- a/apps/frontend/src/app/pages/maps/map-info/map-leaderboard/map-leaderboard.component.html +++ b/apps/frontend/src/app/pages/maps/map-info/map-leaderboard/map-leaderboard.component.html @@ -8,7 +8,10 @@ (click)="selectMode($index)" [ngClass]="{ '!opacity-100': activeModeIndex === $index, 'pointer-events-none': leaderboards.length === 1 }" > - +

{{ groupedLeaderboard.gamemodeName }}

diff --git a/apps/frontend/src/app/pages/maps/map-info/map-submission/map-submission.component.html b/apps/frontend/src/app/pages/maps/map-info/map-submission/map-submission.component.html index 8fee445b1..180a4aef7 100644 --- a/apps/frontend/src/app/pages/maps/map-info/map-submission/map-submission.component.html +++ b/apps/frontend/src/app/pages/maps/map-info/map-submission/map-submission.component.html @@ -42,7 +42,7 @@ } @for (bonus of gamemode.value.get(TrackType.BONUS); track $index) { -

B{{ bonus.trackNum + 1 }}

+

B{{ bonus.trackNum }}

{{ bonus.tier ?? '' }}

@if (bonus.type === LeaderboardType.RANKED) { diff --git a/apps/frontend/src/app/pages/maps/map-info/map-submission/map-submission.component.ts b/apps/frontend/src/app/pages/maps/map-info/map-submission/map-submission.component.ts index 28ec7795a..c89216e6f 100644 --- a/apps/frontend/src/app/pages/maps/map-info/map-submission/map-submission.component.ts +++ b/apps/frontend/src/app/pages/maps/map-info/map-submission/map-submission.component.ts @@ -3,7 +3,6 @@ import { MMap, MapSubmissionType, MapStatusName, - MapSubmissionSuggestion, TrackType, MapSubmissionVersion, LeaderboardType, @@ -42,9 +41,7 @@ export class MapSubmissionComponent { } @Input({ required: true }) set map(map: MMap) { this._map = map; - this.suggestions = groupMapSuggestions( - map.submission.suggestions as MapSubmissionSuggestion[] // Cast until I can remove Jsonify<> bullshit - ); + this.suggestions = groupMapSuggestions(map.submission.suggestions); this.versions = map?.submission?.versions.toReversed(); this.visibleVersions = 2; } diff --git a/apps/frontend/src/app/pages/maps/submission-form/map-submission-form.component.ts b/apps/frontend/src/app/pages/maps/submission-form/map-submission-form.component.ts index fbf0eb639..03333ff07 100644 --- a/apps/frontend/src/app/pages/maps/submission-form/map-submission-form.component.ts +++ b/apps/frontend/src/app/pages/maps/submission-form/map-submission-form.component.ts @@ -261,14 +261,14 @@ export class MapSubmissionFormComponent implements OnInit, ConfirmDeactivate { { gamemode, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, type: LeaderboardType.RANKED, tier: 1 }, ...this.zones.tracks.bonuses.map((_, i) => ({ gamemode, trackType: TrackType.BONUS, - trackNum: i, + trackNum: i + 1, type: LeaderboardType.RANKED as LeaderboardType.RANKED, tier: 1 })) diff --git a/apps/frontend/src/app/util/grouped-map-leaderboards.util.ts b/apps/frontend/src/app/util/grouped-map-leaderboards.util.ts index ae4aa8cca..ca366bf6a 100644 --- a/apps/frontend/src/app/util/grouped-map-leaderboards.util.ts +++ b/apps/frontend/src/app/util/grouped-map-leaderboards.util.ts @@ -52,7 +52,7 @@ export function groupMapLeaderboards( // Bonuses if (!entry.bonuses) entry.bonuses = []; entry.bonuses.push({ - num: lb.trackNum + 1, // trackNums start at 0 + num: lb.trackNum, tier: lb.tier, type: lb.type }); diff --git a/libs/constants/src/types/queries/map-queries.model.ts b/libs/constants/src/types/queries/map-queries.model.ts index 7f962c1a7..18c8adb95 100644 --- a/libs/constants/src/types/queries/map-queries.model.ts +++ b/libs/constants/src/types/queries/map-queries.model.ts @@ -178,7 +178,7 @@ export type MapRunsGetFilter = 'around' | 'friends'; export type MapLeaderboardGetQuery = PagedQuery & { gamemode: Gamemode; trackType?: TrackType; // Default 0 - trackNum?: number; // Default 0 + trackNum?: number; // Default 1 style?: Style; // Default 0 expand?: MapRunsGetExpand; filter?: MapRunsGetFilter; @@ -189,7 +189,7 @@ export type MapLeaderboardGetQuery = PagedQuery & { export type MapLeaderboardGetRunQuery = PagedQuery & { gamemode: Gamemode; trackType?: TrackType; // Default 0 - trackNum?: number; // Default 0 + trackNum?: number; // Default 1 style?: Style; // Default 0 expand?: MapRunsGetExpand; userID?: number; diff --git a/libs/constants/src/types/queries/run-queries.model.ts b/libs/constants/src/types/queries/run-queries.model.ts index 938ee50f0..69f20db2b 100644 --- a/libs/constants/src/types/queries/run-queries.model.ts +++ b/libs/constants/src/types/queries/run-queries.model.ts @@ -17,7 +17,7 @@ export type RunsGetAllQuery = PagedQuery & { mapName?: string; gamemode?: Gamemode; trackType?: TrackType; // Default 0 - trackNum?: number; // Default 0 + trackNum?: number; // Default 1 style?: Style; // Default 0 flags?: number[]; userID?: number; diff --git a/libs/formats/zone/src/suggestions-validator.spec.ts b/libs/formats/zone/src/suggestions-validator.spec.ts index 55167f65c..f5921d946 100644 --- a/libs/formats/zone/src/suggestions-validator.spec.ts +++ b/libs/formats/zone/src/suggestions-validator.spec.ts @@ -28,7 +28,7 @@ describe('validateSuggestions', () => { const validSubmissionSuggestions: MapSubmissionSuggestion[] = [ { trackType: TT.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, tier: 1, comment: 'This track came to me in a dream', @@ -36,7 +36,7 @@ describe('validateSuggestions', () => { }, { trackType: TT.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, tier: 1, comment: 'This track sucks', @@ -47,14 +47,14 @@ describe('validateSuggestions', () => { const validApprovals: MapSubmissionApproval[] = [ { trackType: TT.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, tier: 1, type: LeaderboardType.UNRANKED }, { trackType: TT.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, tier: 1, type: LeaderboardType.RANKED @@ -64,14 +64,14 @@ describe('validateSuggestions', () => { const validReviewSuggestions: MapReviewSuggestion[] = [ { trackType: TT.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, tier: 1, gameplayRating: 1 }, { trackType: TT.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, tier: 1, gameplayRating: 10 @@ -123,7 +123,7 @@ describe('validateSuggestions', () => { ...validSubmissionSuggestions, { trackType: TT.BONUS, - trackNum: 1, + trackNum: 2, gamemode: Gamemode.BHOP, tier: 1, comment: 'This track doesnt exist', @@ -141,7 +141,7 @@ describe('validateSuggestions', () => { ...validApprovals, { trackType: TT.BONUS, - trackNum: 1, + trackNum: 2, gamemode: Gamemode.BHOP, tier: 1, type: LeaderboardType.RANKED @@ -158,7 +158,7 @@ describe('validateSuggestions', () => { ...validReviewSuggestions, { trackType: TT.BONUS, - trackNum: 1, + trackNum: 2, gamemode: Gamemode.BHOP, gameplayRating: 5 } @@ -207,7 +207,7 @@ describe('validateSuggestions', () => { [ { trackType: TT.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, tier: 1, comment: 'someComment', @@ -224,7 +224,7 @@ describe('validateSuggestions', () => { [ { trackType: TT.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, tier: 1, type: LeaderboardType.RANKED @@ -240,7 +240,7 @@ describe('validateSuggestions', () => { [ { trackType: TT.BONUS, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, tier: 1, gameplayRating: 1 @@ -259,7 +259,7 @@ describe('validateSuggestions', () => { ...validSubmissionSuggestions, { trackType: TT.MAIN, - trackNum: 1, + trackNum: 2, gamemode: Gamemode.AHOP, tier: 2, comment: 'someComment', @@ -269,7 +269,7 @@ describe('validateSuggestions', () => { zones, SuggestionType.SUBMISSION ) - ).toThrow('Multiple main tracks'); + ).toThrow('Only one main track allowed, must be track 1'); expect(() => validateSuggestions( @@ -277,7 +277,7 @@ describe('validateSuggestions', () => { ...validApprovals, { trackType: TT.MAIN, - trackNum: 1, + trackNum: 2, gamemode: Gamemode.AHOP, tier: 2, type: LeaderboardType.RANKED @@ -286,7 +286,7 @@ describe('validateSuggestions', () => { zones, SuggestionType.APPROVAL ) - ).toThrow('Multiple main tracks'); + ).toThrow('Only one main track allowed, must be track 1'); expect(() => validateSuggestions( @@ -294,7 +294,7 @@ describe('validateSuggestions', () => { ...validSubmissionSuggestions, { trackType: TT.MAIN, - trackNum: 1, + trackNum: 2, gamemode: Gamemode.AHOP, tier: 2 } @@ -302,7 +302,7 @@ describe('validateSuggestions', () => { zones, SuggestionType.REVIEW ) - ).toThrow('Multiple main tracks'); + ).toThrow('Only one main track allowed, must be track 1'); }); it('should throw error for stages in suggestions', () => { @@ -312,7 +312,7 @@ describe('validateSuggestions', () => { ...validSubmissionSuggestions, { trackType: TT.STAGE, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, tier: 1, comment: 'someComment', @@ -330,7 +330,7 @@ describe('validateSuggestions', () => { ...validApprovals, { trackType: TT.STAGE, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, tier: 1, type: LeaderboardType.RANKED @@ -347,7 +347,7 @@ describe('validateSuggestions', () => { ...validSubmissionSuggestions, { trackType: TT.STAGE, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.AHOP, tier: 1, gameplayRating: 6 @@ -366,7 +366,7 @@ describe('validateSuggestions', () => { ...validSubmissionSuggestions, { trackType: TT.MAIN, - trackNum: 0, + trackNum: 1, // validSuggestions has ahop, we mocked IncompatibleGamemodes.get to be incomp with bhop gamemode: Gamemode.BHOP, tier: 1, @@ -385,7 +385,7 @@ describe('validateSuggestions', () => { ...validApprovals, { trackType: TT.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.BHOP, tier: 1, type: LeaderboardType.RANKED @@ -402,7 +402,7 @@ describe('validateSuggestions', () => { ...validSubmissionSuggestions, { trackType: TT.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.BHOP, tier: 1, gameplayRating: 4 @@ -421,7 +421,7 @@ describe('validateSuggestions', () => { ...validSubmissionSuggestions, { trackType: TT.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.SURF, tier: 1, comment: 'someComment', @@ -439,7 +439,7 @@ describe('validateSuggestions', () => { ...validApprovals, { trackType: TT.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.SURF, tier: 1, type: LeaderboardType.RANKED @@ -456,7 +456,7 @@ describe('validateSuggestions', () => { ...validSubmissionSuggestions, { trackType: TT.MAIN, - trackNum: 0, + trackNum: 1, gamemode: Gamemode.SURF, tier: 1, gameplayRating: 7 @@ -522,7 +522,7 @@ describe('validateSuggestions', () => { { gamemode: Gamemode.RJ, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, tier: 1, type: LeaderboardType.HIDDEN } @@ -541,4 +541,19 @@ describe('validateSuggestions', () => { validateSuggestions(suggs, zones, SuggestionType.APPROVAL) ).toThrow('Missing non-hidden leaderboards for main track'); }); + + it('should throw for trackNum of 0', () => { + const suggs = structuredClone(validApprovals); + + suggs[0].trackNum = 0; + expect(() => + validateSuggestions(suggs, zones, SuggestionType.APPROVAL) + ).toThrow('Only one main track allowed, must be track 1'); + + suggs[0].trackNum = 1; + suggs.push({ ...suggs[1], trackNum: 0 }); + expect(() => + validateSuggestions(suggs, zones, SuggestionType.APPROVAL) + ).toThrow('Suggestion refers to bonus track (0) that does not exist'); + }); }); diff --git a/libs/formats/zone/src/suggestions-validator.ts b/libs/formats/zone/src/suggestions-validator.ts index 5f897f048..67fdcdc3c 100644 --- a/libs/formats/zone/src/suggestions-validator.ts +++ b/libs/formats/zone/src/suggestions-validator.ts @@ -33,7 +33,7 @@ function leaderboardName( ) { let str = gamemode != null ? `${GamemodeInfo.get(gamemode).name} ` : ''; str += TTName.get(trackType).toLowerCase(); - str += trackType === TrackType.MAIN ? ' track' : ` ${trackNum + 1}`; + str += trackType === TrackType.MAIN ? ' track' : ` ${trackNum}`; return str; } @@ -96,10 +96,12 @@ export function validateSuggestions( // Must have one and only one main track (in at least one gamemode) if (tt === TT.MAIN) { - if (tn === 0) { + if (tn === 1) { hasMainTrack = true; } else { - throw new SuggestionValidationError('Multiple main tracks'); + throw new SuggestionValidationError( + 'Only one main track allowed, must be track 1' + ); } } @@ -131,7 +133,7 @@ export function validateSuggestions( if ( 'gameplayRating' in sugg && // Buggy rule, destructuring above isn't type-safe. - /* eslint-disable unicorn/consistent-destructuring */ + /* eslint-disable unicorn/consistent-destructuring */ sugg.gameplayRating != null && (sugg.gameplayRating <= 0 || sugg.gameplayRating > 10 || @@ -170,14 +172,14 @@ export function validateSuggestions( // Zone and suggestions must have main tracks per their respective validators, // and we don't do suggestions for stages, so all that's left is to check that // all bonus tracks have suggestions: - for (let i = 0; i < zoneData.tracks.bonuses.length; i++) { + for (let i = 1; i < zoneData.tracks.bonuses.length + 1; i++) { if ( !suggestions.some( ({ trackType, trackNum }) => trackType === TT.BONUS && trackNum === i ) ) { throw new SuggestionValidationError( - `Bonus track ${i + 1} has no suggestions` + `Bonus track ${i} has no suggestions` ); } } @@ -185,8 +187,11 @@ export function validateSuggestions( if (type === SuggestionType.APPROVAL) { [ - [TrackType.MAIN, 0], - ...arrayFrom(zoneData.tracks.bonuses.length, (i) => [TrackType.BONUS, i]) + [TrackType.MAIN, 1], + ...arrayFrom(zoneData.tracks.bonuses.length, (i) => [ + TrackType.BONUS, + i + 1 + ]) ].forEach(([trackType, trackNum]) => { if ( !suggestions.some( @@ -209,11 +214,9 @@ export function validateSuggestions( suggestions .filter(({ trackType }) => trackType === TrackType.BONUS) .forEach(({ trackNum }) => { - if (!zoneData.tracks.bonuses[trackNum]) { + if (!zoneData.tracks.bonuses[trackNum - 1]) { throw new SuggestionValidationError( - `Suggestion refers to bonus track (${ - trackNum + 1 - }) that does not exist` + `Suggestion refers to bonus track (${trackNum}) that does not exist` ); } }); diff --git a/libs/formats/zone/src/zones.stub.ts b/libs/formats/zone/src/zones.stub.ts index f0c511276..8038ecde9 100644 --- a/libs/formats/zone/src/zones.stub.ts +++ b/libs/formats/zone/src/zones.stub.ts @@ -176,13 +176,13 @@ export const ZonesStub: MapZones = { export const ZonesStubLeaderboards = [ ...[ GM.RJ, GM.SJ, GM.CONC, GM.DEFRAG_CPM, GM.DEFRAG_VQ3, GM.DEFRAG_VTG ] .flatMap((gamemode) => [ - { gamemode, trackType: TrackType.MAIN, trackNum: 0, linear: false }, - { gamemode, trackType: TrackType.STAGE, trackNum: 0, linear: null }, - { gamemode, trackType: TrackType.STAGE, trackNum: 1, linear: null } + { gamemode, trackType: TrackType.MAIN, trackNum: 1, linear: false }, + { gamemode, trackType: TrackType.STAGE, trackNum: 1, linear: null }, + { gamemode, trackType: TrackType.STAGE, trackNum: 2, linear: null } ]), ...[ GM.RJ, GM.SJ, GM.AHOP, GM.BHOP, GM.BHOP_HL1, GM.CONC, GM.DEFRAG_CPM, GM.DEFRAG_VQ3, GM.DEFRAG_VTG ] .map((gamemode) => ( - { gamemode, trackType: TrackType.BONUS, trackNum: 0, linear: null })) + { gamemode, trackType: TrackType.BONUS, trackNum: 1, linear: null })) ].sort(); /** diff --git a/libs/test-utils/src/utils/db.util.ts b/libs/test-utils/src/utils/db.util.ts index e377bde6a..65b3ab8d4 100644 --- a/libs/test-utils/src/utils/db.util.ts +++ b/libs/test-utils/src/utils/db.util.ts @@ -154,7 +154,7 @@ export class DbUtil { { gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, tier: 1, type: LeaderboardType.RANKED } @@ -179,7 +179,7 @@ export class DbUtil { create: { gamemode: Gamemode.AHOP, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0, tier: 1, linear: true, @@ -247,7 +247,7 @@ export class DbUtil { { gamemode, trackType: TrackType.MAIN, - trackNum: 0, + trackNum: 1, style: 0, tier: 1, linear: true, @@ -256,21 +256,21 @@ export class DbUtil { { gamemode, trackType: TrackType.STAGE, - trackNum: 0, + trackNum: 1, style: 0, type: LeaderboardType.RANKED }, { gamemode, trackType: TrackType.STAGE, - trackNum: 1, + trackNum: 2, style: 0, type: LeaderboardType.RANKED }, { gamemode, trackType: TrackType.BONUS, - trackNum: 0, + trackNum: 1, style: 0, tier: 5, type: LeaderboardType.RANKED @@ -319,7 +319,7 @@ export class DbUtil { mapID: map.id, gamemode: args?.gamemode ?? Gamemode.AHOP, trackType: args?.trackType ?? TrackType.MAIN, - trackNum: args?.trackNum ?? 0, + trackNum: args?.trackNum ?? 1, style: args?.style ?? 0 } } @@ -330,7 +330,7 @@ export class DbUtil { user: { connect: { id: user.id } }, gamemode: args?.gamemode ?? Gamemode.AHOP, trackType: args?.trackType ?? TrackType.MAIN, - trackNum: args?.trackNum ?? 0, + trackNum: args?.trackNum ?? 1, style: args?.style ?? 0, time: args?.time ?? 1 } @@ -364,8 +364,8 @@ export class DbUtil { user: { connect: { id: user.id } }, mmap: { connect: { id: map.id } }, gamemode: args?.gamemode ?? Gamemode.AHOP, - trackNum: args?.trackNum ?? 0, - trackType: args?.trackType ?? 0, + trackNum: args?.trackNum ?? 1, + trackType: args?.trackType ?? TrackType.MAIN, style: args?.style ?? 0, time: args?.time ?? 1, flags: args?.flags ?? [0], @@ -383,8 +383,8 @@ export class DbUtil { mapID_gamemode_trackType_trackNum_style: { mapID: map.id, gamemode: args?.gamemode ?? Gamemode.AHOP, - trackNum: args?.trackNum ?? 0, - trackType: args?.trackType ?? 0, + trackNum: args?.trackNum ?? 1, + trackType: args?.trackType ?? TrackType.MAIN, style: args?.style ?? 0 } } diff --git a/scripts/src/seed.script.ts b/scripts/src/seed.script.ts index 60315d8a2..205f4f6cf 100644 --- a/scripts/src/seed.script.ts +++ b/scripts/src/seed.script.ts @@ -452,15 +452,15 @@ prismaWrapper(async (prisma: PrismaClient) => { [ { trackType: TrackType.MAIN, - trackNum: 0 + trackNum: 1 }, ...arrayFrom(zones.tracks.main.zones.segments.length, (i) => ({ trackType: TrackType.STAGE, - trackNum: i /* + 1 */ + trackNum: i + 1 })), ...arrayFrom(zones.tracks.bonuses.length, (i) => ({ trackType: TrackType.BONUS, - trackNum: i + trackNum: i + 1 })) ].map(({ trackType, trackNum }) => { const leaderboard = {