[+] Allow querying card user ids

This commit is contained in:
Azalea
2024-03-01 00:38:33 -05:00
parent fa9b738cba
commit 63cf1f5fa1
5 changed files with 26 additions and 18 deletions

View File

@@ -19,25 +19,25 @@ class Chusan(
val userGeneralDataRepository: UserGeneralDataRepository
): GameApiController
{
override fun trend(@RP username: Str): List<TrendOut> = us.byName(username) { u ->
findTrend(userPlaylogRepository.findByUser_Card_ExtId(u.ghostCard.extId)
override fun trend(@RP username: Str): List<TrendOut> = us.cardByName(username) { card ->
findTrend(userPlaylogRepository.findByUser_Card_ExtId(card.extId)
.map { TrendLog(it.playDate.toString(), it.playerRating) })
}
// Only show > AAA rank
private val shownRanks = chu3Scores.filter { it.first >= 95 * 10000 }
override fun userSummary(@RP username: Str) = us.byName(username) { u ->
override fun userSummary(@RP username: Str) = us.cardByName(username) { card ->
// Summary values: total plays, player rating, server-wide ranking
// number of each rank, max combo, number of full combo, number of all perfect
val extra = userGeneralDataRepository.findByUser_Card_ExtId(u.ghostCard.extId)
val extra = userGeneralDataRepository.findByUser_Card_ExtId(card.extId)
.associate { it.propertyKey to it.propertyValue }
val ratingComposition = mapOf(
"recent" to (extra["recent_rating_list"] ?: ""),
)
genericUserSummary(u, userDataRepository, userPlaylogRepository, shownRanks, ratingComposition)
genericUserSummary(card, userDataRepository, userPlaylogRepository, shownRanks, ratingComposition)
}
override fun ranking() = genericRanking(userDataRepository, userPlaylogRepository)

View File

@@ -19,16 +19,16 @@ class Maimai2(
val userGeneralDataRepository: UserGeneralDataRepository
): GameApiController
{
override fun trend(@RP username: Str): List<TrendOut> = us.byName(username) { u ->
findTrend(userPlaylogRepository.findByUser_Card_ExtId(u.ghostCard.extId)
override fun trend(@RP username: Str): List<TrendOut> = us.cardByName(username) { card ->
findTrend(userPlaylogRepository.findByUser_Card_ExtId(card.extId)
.map { TrendLog(it.playDate, it.afterRating) })
}
// Only show > S rank
private val shownRanks = mai2Scores.filter { it.first >= 97 * 10000 }
override fun userSummary(@RP username: Str) = us.byName(username) { u ->
val extra = userGeneralDataRepository.findByUser_Card_ExtId(u.ghostCard.extId)
override fun userSummary(@RP username: Str) = us.cardByName(username) { card ->
val extra = userGeneralDataRepository.findByUser_Card_ExtId(card.extId)
.associate { it.propertyKey to it.propertyValue }
val ratingComposition = mapOf(
@@ -36,7 +36,7 @@ class Maimai2(
"best15" to (extra["recent_rating_new"] ?: "")
)
genericUserSummary(u, userDataRepository, userPlaylogRepository, shownRanks, ratingComposition)
genericUserSummary(card, userDataRepository, userPlaylogRepository, shownRanks, ratingComposition)
}
override fun ranking() = genericRanking(userDataRepository, userPlaylogRepository)

View File

@@ -16,20 +16,20 @@ class Ongeki(
val userDataRepository: UserDataRepository,
val userGeneralDataRepository: UserGeneralDataRepository
): GameApiController {
override fun trend(username: String) = us.byName(username) { u ->
findTrend(userPlaylogRepository.findByUser_Card_ExtId(u.ghostCard.extId)
override fun trend(username: String) = us.cardByName(username) { card ->
findTrend(userPlaylogRepository.findByUser_Card_ExtId(card.extId)
.map { TrendLog(it.playDate, it.playerRating) })
}
private val shownRanks = ongekiScores.filter { it.first >= 950000 }
override fun userSummary(username: String) = us.byName(username) { u ->
override fun userSummary(username: String) = us.cardByName(username) { card ->
// val extra = userGeneralDataRepository.findByUser_Card_ExtId(u.ghostCard.extId)
// .associate { it.propertyKey to it.propertyValue }
// TODO: Rating composition
genericUserSummary(u, userDataRepository, userPlaylogRepository, shownRanks, mapOf())
genericUserSummary(card, userDataRepository, userPlaylogRepository, shownRanks, mapOf())
}
override fun ranking() = genericRanking(userDataRepository, userPlaylogRepository)