Pull recent plays to Song page
This commit is contained in:
parent
2b45deb987
commit
0a8cf361f8
@ -1,6 +1,7 @@
|
||||
using GameDatabase.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SharedProject.Utils;
|
||||
using SharedProject.Entities;
|
||||
|
||||
namespace GameDatabase.Context
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using SharedProject.Enums;
|
||||
using SharedProject.Entities;
|
||||
|
||||
namespace GameDatabase.Entities;
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
namespace GameDatabase.Entities
|
||||
using SharedProject.Entities;
|
||||
|
||||
namespace GameDatabase.Entities
|
||||
{
|
||||
public partial class Card
|
||||
{
|
||||
|
@ -1,4 +1,6 @@
|
||||
namespace GameDatabase.Entities
|
||||
using SharedProject.Entities;
|
||||
|
||||
namespace GameDatabase.Entities
|
||||
{
|
||||
public partial class Credential
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using SharedProject.Enums;
|
||||
using SharedProject.Entities;
|
||||
|
||||
namespace GameDatabase.Entities;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using SharedProject.Enums;
|
||||
using SharedProject.Entities;
|
||||
|
||||
namespace GameDatabase.Entities
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using SharedProject.Enums;
|
||||
|
||||
namespace GameDatabase.Entities
|
||||
namespace SharedProject.Entities
|
||||
{
|
||||
public partial class SongPlayDatum
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using SharedProject.Enums;
|
||||
|
||||
namespace GameDatabase.Entities
|
||||
namespace SharedProject.Entities
|
||||
{
|
||||
public partial class UserDatum
|
||||
{
|
@ -1,4 +1,5 @@
|
||||
using SharedProject.Enums;
|
||||
using SharedProject.Entities;
|
||||
|
||||
namespace SharedProject.Models;
|
||||
|
||||
@ -46,4 +47,6 @@ public class SongBestData
|
||||
public List<AiSectionBestData> AiSectionBestData { get; set; } = new();
|
||||
|
||||
public bool ShowAiData { get; set; }
|
||||
|
||||
public List<SongPlayDatum> RecentPlayData { get; set; } = new();
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
using GameDatabase.Entities;
|
||||
using SharedProject.Entities;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace TaikoLocalServer.Common.Utils;
|
||||
|
@ -47,6 +47,12 @@ public class PlayDataController : BaseController<PlayDataController>
|
||||
songBestRecord.IsFavorite = true;
|
||||
}
|
||||
|
||||
foreach (var songBestRecord in songBestRecords)
|
||||
{
|
||||
songBestRecord.RecentPlayData = playLogs.Where(datum => datum.SongId == songBestRecord.SongId)
|
||||
.OrderByDescending(datum => datum.PlayTime).Take(15).ToList();
|
||||
}
|
||||
|
||||
return Ok(new SongBestResponse
|
||||
{
|
||||
SongBestData = songBestRecords
|
||||
|
@ -1,4 +1,5 @@
|
||||
using GameDatabase.Entities;
|
||||
using SharedProject.Entities;
|
||||
|
||||
namespace TaikoLocalServer.Controllers.Game;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using GameDatabase.Entities;
|
||||
using SharedProject.Entities;
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
using Throw;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using GameDatabase.Entities;
|
||||
using SharedProject.Entities;
|
||||
|
||||
namespace TaikoLocalServer.Services.Interfaces;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
using GameDatabase.Entities;
|
||||
using SharedProject.Entities;
|
||||
|
||||
namespace TaikoLocalServer.Services.Interfaces;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using GameDatabase.Context;
|
||||
using GameDatabase.Entities;
|
||||
using SharedProject.Entities;
|
||||
using SharedProject.Models;
|
||||
using Swan.Mapping;
|
||||
using Throw;
|
||||
|
@ -1,5 +1,5 @@
|
||||
using GameDatabase.Context;
|
||||
using GameDatabase.Entities;
|
||||
using SharedProject.Entities;
|
||||
|
||||
namespace TaikoLocalServer.Services;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
using GameDatabase.Context;
|
||||
using GameDatabase.Entities;
|
||||
using SharedProject.Entities;
|
||||
using System.Text.Json;
|
||||
using Throw;
|
||||
|
||||
|
@ -25,7 +25,34 @@ else
|
||||
<MudText Typo="Typo.h5">@SongTitle</MudText>
|
||||
<MudText Typo="Typo.body2">@SongArtist</MudText>
|
||||
<MudGrid Class="my-4 pb-10">
|
||||
|
||||
<MudItem xs="12">
|
||||
<MudCard Outlined="true" Elevation="0">
|
||||
<MudCardHeader>
|
||||
<MudText Typo="Typo.h6">Recent Plays</MudText>
|
||||
</MudCardHeader>
|
||||
<MudCardContent>
|
||||
@if (SongBestData is not null && SongBestData.RecentPlayData is not null && SongBestData.RecentPlayData.Count > 0)
|
||||
{
|
||||
<MudTable Items="@SongBestData.RecentPlayData" Class="table-striped" Dense="true">
|
||||
<HeaderContent>
|
||||
<MudTh>Play Time</MudTh>
|
||||
<MudTh>Difficulty</MudTh>
|
||||
<MudTh>Score</MudTh>
|
||||
</HeaderContent>
|
||||
<RowTemplate>
|
||||
<MudTd>@context.PlayTime</MudTd>
|
||||
<MudTd>@context.Difficulty</MudTd>
|
||||
<MudTd>@context.Score</MudTd>
|
||||
</RowTemplate>
|
||||
</MudTable>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudText Typo="Typo.body2">No recent plays</MudText>
|
||||
}
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user