Skip to content

Commit

Permalink
Add a setter for Run Time.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTedder committed Aug 11, 2024
1 parent a5f203b commit 636ab19
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion LeaderboardBackend/Models/Entities/Run.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.ComponentModel.DataAnnotations.Schema;
using NodaTime;

namespace LeaderboardBackend.Models.Entities;
Expand All @@ -20,7 +21,12 @@ public class Run

public RunType Type => Category.Type;

public Duration Time => Duration.FromNanoseconds(TimeOrScore);
[NotMapped]
public Duration Time
{
get => Duration.FromNanoseconds(TimeOrScore);
set => TimeOrScore = value.ToInt64Nanoseconds();
}

/// <summary>
/// The duration of the run in nanoseconds if the run belongs to a timed category, otherwise the score.
Expand Down

0 comments on commit 636ab19

Please sign in to comment.