Finish prototype for web interface

Only unlock unlockable songs at first write
This commit is contained in:
Yuchen Ji
2022-06-21 03:40:42 +08:00
parent d3265dbc02
commit c8b8a2816e
13 changed files with 111 additions and 49 deletions
+2 -21
View File
@@ -1,6 +1,7 @@
@page "/user/{CardId:long}"
@using SharedProject.models
@using SharedProject.enums
@using SharedProject.common
@inject HttpClient Client
@inject IDialogService DialogService
@inject ILogger<User> Logger
@@ -147,18 +148,6 @@ else
private bool isSavingOptions;
private static readonly ScoreGradeMap[] GRADES =
{
new(0, "E"),
new(300000, "D"),
new(500000, "C"),
new(700000, "B"),
new(800000, "A"),
new(900000, "S"),
new(950000, "S+"),
new(990000, "S++"),
};
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
@@ -186,17 +175,9 @@ else
isSavingOptions = false;
}
public record ScoreGradeMap(int Score, string Grade)
{
public override string ToString()
{
return $"{{ Score = {Score}, Grade = {Grade} }}";
}
}
private static string CalculateRating(int score)
{
var grade = GRADES.Where(g => g.Score <= score).Select(g => g.Grade).Last();
var grade = SharedConstants.GRADES.Where(g => g.Score <= score).Select(g => g.Grade).Last();
return grade;
}