feat(mlg): /db routes: import .MLG, a unit's timeline, monitoring at T
POST /db/import/mlg_file (per-file status; good files stored even when
another in the request is refused; each file's modified time as a JSON
form field), GET /db/units/{serial}/timeline (optionally windowed),
GET /db/units/{serial}/monitoring_at, GET /db/mlg_records, and
GET /db/mlg_files/{id} (the original, byte for byte, for printing).
Tested by calling the route functions directly: httpx is not in this
venv, so TestClient tests would skip silently.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R9LdWawLzUxwewZGA1
This commit is contained in:
1 parent
faa371a73b
commit
c0cdf58527
4 files changed
+265
-1
No files matched your search
@@ -148,3 +148,13 @@ def test_no_data_gives_an_empty_timeline():
|
||||
tl = build_timeline([], [])
|
||||
assert tl == {"sessions": [], "gaps": [], "clock_steps": [], "call_ins": []}
|
||||
assert monitoring_at(tl, dt(2026, 9, 8))["status"] == "unknown"
|
||||
|
||||
|
||||
def test_window_filters_call_ins_by_unit_time_and_empty_files_by_file_time(tmp_path):
|
||||
from sfm.mlg_timeline import window
|
||||
tl = _timeline(tmp_path, "BE6907", "BE6907750.MLG", "BE6907751.MLG") # files at BASE, BASE+1h (UTC)
|
||||
late = window(tl, dt(2026, 8, 23), None)
|
||||
assert [(c["kind"], c["unit_time"]) for c in late["call_ins"]] == [("delivered", "2026-08-23T18:30:00")]
|
||||
around_file = window(tl, dt(2025, 12, 31), dt(2026, 1, 2))
|
||||
assert [c["kind"] for c in around_file["call_ins"]] == ["nothing_new"]
|
||||
assert window(tl, None, None)["call_ins"] == tl["call_ins"]
|
||||
Reference in new issue
Block a user