1
0
mirror of synced 2025-01-19 00:04:05 +01:00

Pull recent plays to Song page

This commit is contained in:
shiibe 2024-03-09 23:49:47 -05:00
parent 2b45deb987
commit 0a8cf361f8
20 changed files with 58 additions and 11 deletions

View File

@ -1,6 +1,7 @@
using GameDatabase.Entities;
using Microsoft.EntityFrameworkCore;
using SharedProject.Utils;
using SharedProject.Entities;
namespace GameDatabase.Context
{

View File

@ -1,4 +1,5 @@
using SharedProject.Enums;
using SharedProject.Entities;
namespace GameDatabase.Entities;

View File

@ -1,4 +1,6 @@
namespace GameDatabase.Entities
using SharedProject.Entities;
namespace GameDatabase.Entities
{
public partial class Card
{

View File

@ -1,4 +1,6 @@
namespace GameDatabase.Entities
using SharedProject.Entities;
namespace GameDatabase.Entities
{
public partial class Credential
{

View File

@ -1,4 +1,5 @@
using SharedProject.Enums;
using SharedProject.Entities;
namespace GameDatabase.Entities;

View File

@ -1,4 +1,5 @@
using SharedProject.Enums;
using SharedProject.Entities;
namespace GameDatabase.Entities
{

View File

@ -1,6 +1,6 @@
using SharedProject.Enums;
namespace GameDatabase.Entities
namespace SharedProject.Entities
{
public partial class SongPlayDatum
{

View File

@ -1,6 +1,6 @@
using SharedProject.Enums;
namespace GameDatabase.Entities
namespace SharedProject.Entities
{
public partial class UserDatum
{

View File

@ -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();
}

View File

@ -1,4 +1,4 @@
using GameDatabase.Entities;
using SharedProject.Entities;
using System.Text.Json;
namespace TaikoLocalServer.Common.Utils;

View File

@ -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

View File

@ -1,4 +1,5 @@
using GameDatabase.Entities;
using SharedProject.Entities;
namespace TaikoLocalServer.Controllers.Game;

View File

@ -1,4 +1,5 @@
using GameDatabase.Entities;
using SharedProject.Entities;
using System.Globalization;
using System.Text.Json;
using Throw;

View File

@ -1,4 +1,4 @@
using GameDatabase.Entities;
using SharedProject.Entities;
namespace TaikoLocalServer.Services.Interfaces;

View File

@ -1,4 +1,4 @@
using GameDatabase.Entities;
using SharedProject.Entities;
namespace TaikoLocalServer.Services.Interfaces;

View File

@ -1,5 +1,6 @@
using GameDatabase.Context;
using GameDatabase.Entities;
using SharedProject.Entities;
using SharedProject.Models;
using Swan.Mapping;
using Throw;

View File

@ -1,5 +1,5 @@
using GameDatabase.Context;
using GameDatabase.Entities;
using SharedProject.Entities;
namespace TaikoLocalServer.Services;

View File

@ -1,5 +1,5 @@
using GameDatabase.Context;
using GameDatabase.Entities;
using SharedProject.Entities;
using System.Text.Json;
using Throw;

View File

@ -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>
}
}