Allow collecting data from EUNE, NA, KR on top of EUW
All checks were successful
pipeline / lint-and-format (push) Successful in 4m44s
pipeline / build-and-push-images (push) Successful in 4m7s

- match_collector: query API and build collections for each platform
- match_collector: aggregate champion stats of each platform in one collection with platform annotations
- frontend: replace stats to count matches in platform-specific collections
- frontend: replace "EUW Challengers" with all supported platforms
- dev: adapted scripts to count match in platforms
This commit is contained in:
2026-04-17 16:25:19 +02:00
parent 0f84b9a707
commit dae65c8fa2
7 changed files with 342 additions and 104 deletions

View File

@@ -1,19 +1,43 @@
import type { MongoClient } from 'mongodb'
import { connectToDatabase, fetchLatestPatch } from '../utils/mongo'
import { connectToDatabase, fetchLatestPatch, getAvailablePlatforms } from '../utils/mongo'
async function fetchGameCount(client: MongoClient, patch: string) {
const database = client.db('matches')
// Check for platform-specific collections
const platforms = await getAvailablePlatforms(client, patch)
if (platforms.length > 0) {
// Sum counts from all platform-specific collections
let totalCount = 0
const platformCounts: Record<string, number> = {}
for (const platform of platforms) {
const collection = database.collection(`${patch}_${platform}`)
const count = await collection.countDocuments()
platformCounts[platform] = count
totalCount += count
}
return { total: totalCount, platforms: platformCounts }
}
// Fall back to old format (single collection)
const matches = database.collection(patch)
const count = await matches.countDocuments()
return count
return { total: count, platforms: {} }
}
export default defineEventHandler(async _ => {
const client = await connectToDatabase()
const latestPatch = await fetchLatestPatch(client)
const gameCount = await fetchGameCount(client, latestPatch)
const gameCountData = await fetchGameCount(client, latestPatch)
await client.close()
return { patch: latestPatch, count: gameCount }
return {
patch: latestPatch,
count: gameCountData.total,
platformCounts: gameCountData.platforms
}
})