1
0
mirror of synced 2024-12-18 01:15:55 +01:00

Fix clear, fc and pfc counts

This commit is contained in:
asesidaa 2022-09-19 20:49:53 +08:00
parent 91a7a40bfc
commit fd9d1a95ab

View File

@ -37,10 +37,9 @@ public class PlayDataController : BaseController<PlayDataController>
var songPlayLogs = playLogs.Where(datum => datum.SongId == songBestData.SongId && var songPlayLogs = playLogs.Where(datum => datum.SongId == songBestData.SongId &&
datum.Difficulty == songBestData.Difficulty).ToList(); datum.Difficulty == songBestData.Difficulty).ToList();
songBestData.PlayCount = songPlayLogs.Count; songBestData.PlayCount = songPlayLogs.Count;
var groups = songPlayLogs.GroupBy(datum => datum.Crown).ToLookup(datums => datums.Key); songBestData.ClearCount = songPlayLogs.Count(datum => datum.Crown >= CrownType.Clear);
songBestData.ClearCount = groups[CrownType.Clear].Count(); songBestData.FullComboCount = songPlayLogs.Count(datum => datum.Crown >= CrownType.Gold);
songBestData.FullComboCount = groups[CrownType.Gold].Count(); songBestData.PerfectCount = songPlayLogs.Count(datum => datum.Crown >= CrownType.Dondaful);
songBestData.PerfectCount = groups[CrownType.Dondaful].Count();
} }
var favoriteSongs = await userDatumService.GetFavoriteSongIds(baid); var favoriteSongs = await userDatumService.GetFavoriteSongIds(baid);
var favoriteSet = favoriteSongs.ToHashSet(); var favoriteSet = favoriteSongs.ToHashSet();