Flag LiveTrack sessions whose map Garmin no longer serves
Ended sessions past the ~24h Garmin appears to keep a live-track page around for get verified once at app startup and, once confirmed dead, flagged so the panel greys them out instead of only failing after a click. Already-flagged sessions are skipped on later startups so this doesn't keep re-hitting Garmin for the same dead session.
This commit is contained in:
1 parent
141b7a08ce
commit
0c4ee97368
5 files changed
+98
-3
No files matched your search
@@ -53,6 +53,35 @@ class LiveTrackStoreTest < Minitest::Test
|
||||
assert_includes ids, "old_with_summary"
|
||||
end
|
||||
|
||||
def test_stale_ended_finds_old_ended_sessions_but_not_active_recent_or_already_flagged_ones
|
||||
@store.add("old_ended", "tok1")
|
||||
@store.set_summary("old_ended", { "active" => false, "end" => (Time.now.utc - 25 * 60 * 60).iso8601 })
|
||||
|
||||
@store.add("recent_ended", "tok2")
|
||||
@store.set_summary("recent_ended", { "active" => false, "end" => Time.now.utc.iso8601 })
|
||||
|
||||
@store.add("still_active", "tok3")
|
||||
@store.set_summary("still_active", { "active" => true })
|
||||
|
||||
@store.add("already_flagged", "tok4")
|
||||
@store.set_summary("already_flagged", { "active" => false, "end" => (Time.now.utc - 25 * 60 * 60).iso8601 })
|
||||
@store.mark_unavailable("already_flagged")
|
||||
|
||||
ids = @store.stale_ended(24 * 60 * 60).map { |s| s["id"] }
|
||||
assert_equal ["old_ended"], ids
|
||||
end
|
||||
|
||||
def test_mark_unavailable_flags_the_session_without_touching_its_summary
|
||||
@store.add("abc123", "tok-abc")
|
||||
@store.set_summary("abc123", { "session_name" => "Test Ride" })
|
||||
|
||||
@store.mark_unavailable("abc123")
|
||||
|
||||
session = @store.find("abc123")
|
||||
assert_equal false, session["map_available"]
|
||||
assert_equal({ "session_name" => "Test Ride" }, session["summary"])
|
||||
end
|
||||
|
||||
def test_data_survives_reload_from_disk
|
||||
@store.add("abc123", "tok-abc")
|
||||
path = @store.instance_variable_get(:@path)
|
||||
|
||||
Reference in new issue
Block a user