Handle cases where gap is reported negative
This commit is contained in:
parent
47f5f9ffa8
commit
56a915a863
1 changed files with 4 additions and 2 deletions
|
@ -149,7 +149,7 @@ impl LeaderBoardEntry {
|
||||||
match self.behind {
|
match self.behind {
|
||||||
BehindLeader::Time(time_behind) => {
|
BehindLeader::Time(time_behind) => {
|
||||||
// check if we are leader
|
// check if we are leader
|
||||||
if time_behind == 0.0 {
|
if time_behind <= 0.0 {
|
||||||
self.time_label.set_text("---")?;
|
self.time_label.set_text("---")?;
|
||||||
} else {
|
} else {
|
||||||
let text = if time_behind > 60.0 {
|
let text = if time_behind > 60.0 {
|
||||||
|
@ -221,7 +221,9 @@ impl LeaderBoardEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn force_display_behind_next(&mut self) -> Result<()> {
|
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 full_minutes = (self.time_behind_next / 60.0).floor();
|
||||||
let remainder = self.time_behind_next - (full_minutes * 60.0);
|
let remainder = self.time_behind_next - (full_minutes * 60.0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue