diff --git a/TMTurboRecords/TMTurboRecords.Client/Components/Pages/Index.razor b/TMTurboRecords/TMTurboRecords.Client/Components/Pages/Index.razor index 3f8955c..16eaae0 100644 --- a/TMTurboRecords/TMTurboRecords.Client/Components/Pages/Index.razor +++ b/TMTurboRecords/TMTurboRecords.Client/Components/Pages/Index.razor @@ -1,4 +1,5 @@ @page "/{map:nonfile?}/{zone?}" +@using System.Globalization @rendermode InteractiveWebAssembly @inject HttpClient Http @@ -122,7 +123,7 @@ - + @switch (context.Item.Record.Platform) @@ -143,7 +144,7 @@ break; } - (@context.Item.Record.PlatformRank) + (@context.Item.Record.PlatformRank) (@context.Item.Record.GetSkillpoints(PlatformResponses[context.Item.Record.Platform.ToString()].Count.GetValueOrDefault()).ToString("n", thousands)) @@ -254,6 +255,8 @@ private CancellationTokenSource? recordRequestTokenSource; + private NumberFormatInfo thousands = new() { NumberGroupSeparator = " ", NumberDecimalDigits = 0 }; + private async Task> SearchZonesAsync(string value) { Zones ??= await Http.GetFromJsonAsync>("api/v1/zones") ?? []; diff --git a/TMTurboRecords/TMTurboRecords.Shared/Models/Record.cs b/TMTurboRecords/TMTurboRecords.Shared/Models/Record.cs index 0b52706..15b3099 100644 --- a/TMTurboRecords/TMTurboRecords.Shared/Models/Record.cs +++ b/TMTurboRecords/TMTurboRecords.Shared/Models/Record.cs @@ -4,6 +4,11 @@ namespace TMTurboRecords.Shared.Models; public readonly record struct Record(int PlatformRank, TimeInt32? Time, int Count, Platform Platform) : IComparable { + public int GetSkillpoints(int totalRecordCount) + { + return (totalRecordCount - (PlatformRank + Count - 1)) * 100 / (PlatformRank + Count - 1); + } + public int CompareTo(Record other) { if (Time == other.Time)