Skip to content

Commit

Permalink
fix: timeline total is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Qinyouzeng committed Mar 26, 2024
1 parent 0b619ca commit 8f7cd99
Showing 1 changed file with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,22 +383,28 @@ public void SetValue(TraceResponseDto trace, DateTime start, DateTime end, int t
{
Faild = true;
}

Left = (int)Math.Floor(Math.Floor((trace.Timestamp - start).TotalMilliseconds) * 100 / total);
Process = (int)Math.Floor(Math.Floor((trace.EndTimestamp - trace.Timestamp).TotalMilliseconds) * 100 / total);
if (Process - 1 < 0) Process = 1;
if (Process + Left - 100 > 0)
if (total == 0)
{
Left = 100 - Process;
Process = 100;
}
else
{
Right = 100 - Left - Process;
if (Right < 0)
Left = (int)Math.Floor(Math.Floor((trace.Timestamp - start).TotalMilliseconds) * 100 / total);
Process = (int)Math.Floor(Math.Floor((trace.EndTimestamp - trace.Timestamp).TotalMilliseconds) * 100 / total);
if (Process - 1 < 0) Process = 1;
if (Process + Left - 100 > 0)
{
Right = 0;
Left = 100 - Process;
}
else
{
Right = 100 - Left - Process;
if (Right < 0)
{
Right = 0;
Left = 100 - Process;
}
}
}
}
}

0 comments on commit 8f7cd99

Please sign in to comment.