Add clear,fc,pfc count
This commit is contained in:
parent
fdbeb3b4bb
commit
752d5d9f8a
@ -15,6 +15,9 @@ public class SongBestData
|
||||
public Difficulty Difficulty { get; set; }
|
||||
|
||||
public int PlayCount { get; set; }
|
||||
public int ClearCount { get; set; }
|
||||
public int FullComboCount { get; set; }
|
||||
public int PerfectCount { get; set; }
|
||||
|
||||
public uint BestScore { get; set; }
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using SharedProject.Models.Responses;
|
||||
using System.Collections.Immutable;
|
||||
using SharedProject.Models.Responses;
|
||||
|
||||
namespace TaikoLocalServer.Controllers.Api;
|
||||
|
||||
@ -30,11 +31,16 @@ public class PlayDataController : BaseController<PlayDataController>
|
||||
}
|
||||
|
||||
var songBestRecords = await songBestDatumService.GetAllSongBestAsModel(baid);
|
||||
var songPlayLogs = await songPlayDatumService.GetSongPlayDatumByBaid(baid);
|
||||
var playLogs = await songPlayDatumService.GetSongPlayDatumByBaid(baid);
|
||||
foreach (var songBestData in songBestRecords)
|
||||
{
|
||||
songBestData.PlayCount = songPlayLogs.Count(datum => datum.SongId == songBestData.SongId &&
|
||||
datum.Difficulty == songBestData.Difficulty);
|
||||
var songPlayLogs = playLogs.Where(datum => datum.SongId == songBestData.SongId &&
|
||||
datum.Difficulty == songBestData.Difficulty).ToList();
|
||||
songBestData.PlayCount = songPlayLogs.Count;
|
||||
var groups = songPlayLogs.GroupBy(datum => datum.Crown).ToLookup(datums => datums.Key);
|
||||
songBestData.ClearCount = groups[CrownType.Clear].Count();
|
||||
songBestData.FullComboCount = groups[CrownType.Gold].Count();
|
||||
songBestData.PerfectCount = groups[CrownType.Dondaful].Count();
|
||||
}
|
||||
var favoriteSongs = await userDatumService.GetFavoriteSongIds(baid);
|
||||
var favoriteSet = favoriteSongs.ToHashSet();
|
||||
|
Loading…
Reference in New Issue
Block a user