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

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

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;