Skip to content

Commit 842273d

Browse files
authored
Merge pull request #52 from veloek/fix-time-accumolation
Fix time accumolation
2 parents 91bceaa + 95b7b6b commit 842273d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Tevling/Components/ChallengeCard.razor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ private async Task DeleteChallenge()
6363

6464
private async Task DrawStats()
6565
{
66-
List<string> users = ScoreBoard!.Scores.Select(score => score.Name).ToList();
67-
List<float> data = ScoreBoard!.Scores.Select(score => score.ScoreValue).ToList();
66+
List<string> users = [.. ScoreBoard!.Scores.Select(score => score.Name)];
67+
List<float> data = [.. ScoreBoard!.Scores.Select(score => score.ScoreValue)];
6868

6969
await JSRuntime.InvokeVoidAsync(
7070
"DrawChallengeStats",

Tevling/Pages/Statistics.razor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public partial class Statistics : ComponentBase, IAsyncDisposable
2222
protected override async Task OnInitializedAsync()
2323
{
2424
_athlete = await AuthenticationService.GetCurrentAthleteAsync();
25-
UpdateMeasurementData();
25+
await UpdateMeasurementData();
2626
}
2727

2828
private Dictionary<string, float[]> GetAggregatedMeasurementData(Func<Activity, float> selector, int monthCount = 3)
@@ -95,7 +95,7 @@ private async Task DrawChart()
9595

9696
string[] months = CreateMonthArray(NumberOfMonthsToReview);
9797

98-
UpdateMeasurementData();
98+
await UpdateMeasurementData();
9999

100100
switch (Measurement)
101101
{

Tevling/Services/ChallengeService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public async Task<ScoreBoard> GetScoreBoardAsync(int challengeId, CancellationTo
356356
float scoreValue = challenge.Measurement switch
357357
{
358358
ChallengeMeasurement.Distance => s.Sum / 1000,
359-
ChallengeMeasurement.Time => TimeSpan.FromSeconds(s.Sum).Hours,
359+
ChallengeMeasurement.Time => (float)TimeSpan.FromSeconds(s.Sum).TotalHours,
360360
ChallengeMeasurement.Elevation => s.Sum,
361361
_ => s.Sum,
362362
};

0 commit comments

Comments
 (0)