Handle cases where gap is reported negative

This commit is contained in:
hodasemi 2023-01-21 07:36:56 +01:00
parent 47f5f9ffa8
commit 56a915a863

View file

@ -149,7 +149,7 @@ impl LeaderBoardEntry {
match self.behind {
BehindLeader::Time(time_behind) => {
// check if we are leader
if time_behind == 0.0 {
if time_behind <= 0.0 {
self.time_label.set_text("---")?;
} else {
let text = if time_behind > 60.0 {
@ -221,7 +221,9 @@ impl LeaderBoardEntry {
}
pub fn force_display_behind_next(&mut self) -> Result<()> {
let text = if self.time_behind_next > 60.0 {
let text = if self.time_behind_next <= 0.0 {
"---".to_string()
} else if self.time_behind_next > 60.0 {
let full_minutes = (self.time_behind_next / 60.0).floor();
let remainder = self.time_behind_next - (full_minutes * 60.0);