fix: remove invalid offline -> online check

This commit is contained in:
Jet 2026-03-23 15:56:25 -07:00
parent 3991d25293
commit 50468db20b
No known key found for this signature in database

View file

@ -208,7 +208,6 @@ pub fn apply_state(
let outcome = match current.state {
CachedState::Unknown => ApplyStateOutcome::Applied,
CachedState::Offline { since } if timestamp < since => ApplyStateOutcome::Stale,
CachedState::Offline { .. } => ApplyStateOutcome::Applied,
CachedState::Live { status: _, since } if timestamp < since => ApplyStateOutcome::Stale,
CachedState::Live { status: current_status, since }
@ -409,16 +408,12 @@ mod tests {
mark_offline(&conn, 3000).unwrap();
assert_eq!(
apply_state(&conn, DoorStatus::Open, 2500, 3100).unwrap(),
ApplyStateOutcome::Stale
);
assert_eq!(
apply_state(&conn, DoorStatus::Open, 3200, 3201).unwrap(),
ApplyStateOutcome::Applied
);
let status = get_status(&conn).unwrap();
assert_eq!(status.status, DoorStatus::Open);
assert_eq!(status.since, Some(3200));
assert_eq!(status.since, Some(2500));
}
#[test]