This commit is contained in:
Azalea
2025-01-05 02:13:55 -05:00
parent 96fb815bd8
commit 56e424c29b
13 changed files with 31 additions and 24 deletions

View File

@@ -146,13 +146,13 @@ abstract class GameApiController<T : IUserData>(val name: String, userDataClass:
plays.forEach { play ->
val lvl = musicMapping[play.musicId]?.notes?.getOrNull(if (play.level == 10) 0 else play.level)?.lv ?: return@forEach
shownRanks.find { (s, _) -> play.achievement > s }?.let { (_, v) ->
val ranks = detailedRanks.getOrPut(lvl.toInt()) { rankMap.toMutableMap() }
val ranks = detailedRanks.getOrPut(lvl.toInt()) { rankMap.mut }
ranks[v] = ranks[v]!! + 1
}
}
// Collapse detailed ranks to get non-detailed ranks map<rank, count>
val ranks = shownRanks.associate { (_, v) -> v to 0 }.toMutableMap().also { ranks ->
val ranks = shownRanks.associate { (_, v) -> v to 0 }.mut.also { ranks ->
plays.forEach { play ->
shownRanks.find { (s, _) -> play.achievement > s }?.let { (_, v) -> ranks[v] = ranks[v]!! + 1 }
}

View File

@@ -2,6 +2,7 @@ package icu.samnyan.aqua.net.games
import ext.isoDate
import ext.minus
import ext.mut
import java.time.LocalDate
const val LETTERS = "" +
@@ -60,7 +61,7 @@ fun findTrend(log: List<TrendLog>): List<TrendOut> {
val trend = d.distinctBy { it.date }
.map { TrendOut(it.date, maxRating[it.date] ?: 0,
playCounts[it.date] ?: 0) }
.sortedBy { it.date }.toMutableList()
.sortedBy { it.date }.mut
// Fill in the missing dates (min date and current date)
trend[0].let { if (it.date > minDate) trend.add(0, TrendOut(minDate, 0, 0)) }

View File

@@ -127,7 +127,7 @@ class Maimai2(
user = repos.userData.findByCardExtId(myCard.extId).orElse(null) ?: (404 - "User not found")
propertyKey = "favorite_rival"
}
val myRivalList = myRival.propertyValue.split(',').filter { it.isNotEmpty() }.toMutableSet()
val myRivalList = myRival.propertyValue.split(',').filter { it.isNotEmpty() }.mut
if (isAdd && myRivalList.size >= 4) {
(400 - "Rival list is full")