Fix condition
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pierre HUBERT 2024-12-30 09:29:28 +01:00
parent 4206d9529b
commit e1136926a1
3 changed files with 9 additions and 8 deletions

View File

@ -1673,9 +1673,9 @@ checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388"
[[package]]
name = "lazy-regex"
version = "3.3.0"
version = "3.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d8e41c97e6bc7ecb552016274b99fbb5d035e8de288c582d9b933af6677bfda"
checksum = "60c7310b93682b36b98fa7ea4de998d3463ccbebd94d935d6b48ba5b6ffa7126"
dependencies = [
"lazy-regex-proc_macros",
"once_cell",
@ -1684,9 +1684,9 @@ dependencies = [
[[package]]
name = "lazy-regex-proc_macros"
version = "3.3.0"
version = "3.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76e1d8b05d672c53cb9c7b920bbba8783845ae4f0b076e02a3db1d02c81b4163"
checksum = "4ba01db5ef81e17eb10a5e0f2109d1b3a3e29bac3070fdbd7d156bf7dbd206a1"
dependencies = [
"proc-macro2",
"quote",

View File

@ -31,7 +31,7 @@ actix-remote-ip = "0.1.0"
futures-util = "0.3.31"
uuid = { version = "1.11.0", features = ["v4", "serde"] }
semver = { version = "1.0.23", features = ["serde"] }
lazy-regex = "3.3.0"
lazy-regex = "3.4.1"
tokio = { version = "1.40.0", features = ["full"] }
tokio_schedule = "0.3.2"
mime_guess = "2.0.5"

View File

@ -130,12 +130,13 @@ pub fn relay_total_runtime_adjusted(relay: &DeviceRelay) -> usize {
let time_start_day = time_start_of_day().unwrap_or(1726696800);
// Check if we have reached reset_time today yet or not
if time_start_day + reset_time as u64 >= time_secs() {
if time_start_day + reset_time as u64 <= time_secs() {
let start_time = time_start_day + reset_time as u64;
let end_time = time_start_day + 3600 * 24 + reset_time as u64;
relay_total_runtime(relay.id, start_time, end_time).unwrap_or(3600 * 24)
} else {
// If we have not reached reset time yet, we need to focus on previous day
}
// If we have not reached reset time yet, we need to focus on previous day
else {
let time_start_yesterday = time_start_day - 3600 * 24;
let start_time = time_start_yesterday + reset_time as u64;
let end_time = time_start_day + reset_time as u64;