Skip to content

Commit

Permalink
fix(ux): 🐛 fix result score overflow (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNZL committed Jun 24, 2023
1 parent 3f5a679 commit 1cc9119
Show file tree
Hide file tree
Showing 2 changed files with 152 additions and 117 deletions.
25 changes: 25 additions & 0 deletions src/Structures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,16 @@ public TimeEntry(DetailedReportTimeEntryResponse timeEntryResponse, DetailedRepo
this.Project = this._me.GetProject(this.ProjectId);
}

public int GetScoreByStart()
{
return (int)(this.StartDate.ToUnixTimeSeconds() >> 2);
}

public int GetScoreByDuration(TimeEntry? longest)
{
return (int)(this.Duration >> 2);
}

public string? GetRawDescription(bool withTrailingSpace = false, bool escapePotentialFlags = false)
{
if (string.IsNullOrEmpty(this._rawDescription))
Expand Down Expand Up @@ -467,6 +477,11 @@ object ICloneable.Clone()
return this.Clone();
}

public int GetScoreByDuration()
{
return (int)(this.Seconds >> 2);
}

public long Seconds
{
get => this?.SubGroups?.Values.Sum(subGroup => subGroup.Seconds) ?? 0;
Expand Down Expand Up @@ -538,6 +553,16 @@ object ICloneable.Clone()
return this.Clone();
}

public int GetScoreByStart()
{
return (int)((this.LatestId ?? 0) >> 2);
}

public int GetScoreByDuration()
{
return (int)(this.Seconds >> 2);
}

public string? GetRawTitle(bool withTrailingSpace = false, bool escapePotentialFlags = false)
{
if (string.IsNullOrEmpty(this._rawTitle))
Expand Down
Loading

0 comments on commit 1cc9119

Please sign in to comment.