Add ai section data to song best data
This commit is contained in:
parent
5647dabfbe
commit
a04f1bf285
22
SharedProject/Models/AiSectionBestData.cs
Normal file
22
SharedProject/Models/AiSectionBestData.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using SharedProject.Enums;
|
||||
|
||||
namespace SharedProject.Models;
|
||||
|
||||
public class AiSectionBestData
|
||||
{
|
||||
public int SectionIndex { get; set; }
|
||||
|
||||
public CrownType Crown { get; set; }
|
||||
|
||||
public bool IsWin { get; set; }
|
||||
|
||||
public uint Score { get; set; }
|
||||
|
||||
public uint GoodCount { get; set; }
|
||||
|
||||
public uint OkCount { get; set; }
|
||||
|
||||
public uint MissCount { get; set; }
|
||||
|
||||
public uint DrumrollCount { get; set; }
|
||||
}
|
@ -42,4 +42,6 @@ public class SongBestData
|
||||
public uint HitCount { get; set; }
|
||||
|
||||
public uint DrumrollCount { get; set; }
|
||||
|
||||
public List<AiSectionBestData> AiSectionBestData { get; set; }
|
||||
}
|
@ -42,6 +42,10 @@ public class SongBestDatumService : ISongBestDatumService
|
||||
|
||||
var result = songbestDbData.Select(datum => datum.CopyPropertiesToNew<SongBestData>()).ToList();
|
||||
|
||||
var aiSectionBest = await context.AiScoreData.Where(datum => datum.Baid == baid)
|
||||
.Include(datum => datum.AiSectionScoreData)
|
||||
.ToListAsync();
|
||||
|
||||
var playLogs = await context.SongPlayData.Where(datum => datum.Baid == baid).ToListAsync();
|
||||
foreach (var bestData in result)
|
||||
{
|
||||
@ -64,6 +68,16 @@ public class SongBestDatumService : ISongBestDatumService
|
||||
nameof(SongPlayDatum.DrumrollCount),
|
||||
nameof(SongPlayDatum.ComboCount)
|
||||
);
|
||||
|
||||
var aiSection = aiSectionBest.FirstOrDefault(datum => datum.Difficulty == bestData.Difficulty &&
|
||||
datum.SongId == bestData.SongId);
|
||||
if (aiSection is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bestData.AiSectionBestData = aiSection.AiSectionScoreData
|
||||
.Select(datum => datum.CopyPropertiesToNew<AiSectionBestData>()).ToList();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user