server: backfill event.project_info fields from compliance config
The 210-byte waveform record only stores "Project:" — client, operator, sensor_location, and notes are device-level settings in SUB 1A, not per-event fields. Backfill those into each event's project_info after download, same pattern as the sample_rate backfill. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -323,6 +323,20 @@ def device_events(
|
|||||||
if ev.sample_rate is None:
|
if ev.sample_rate is None:
|
||||||
ev.sample_rate = info.compliance_config.sample_rate
|
ev.sample_rate = info.compliance_config.sample_rate
|
||||||
|
|
||||||
|
# Backfill event.project_info fields that the 210-byte waveform record doesn't carry.
|
||||||
|
# The waveform record only stores "Project:" — client/operator/sensor_location/notes
|
||||||
|
# live in the SUB 1A compliance config, not in the per-event record.
|
||||||
|
if info.compliance_config:
|
||||||
|
cc = info.compliance_config
|
||||||
|
for ev in events:
|
||||||
|
if ev.project_info is None:
|
||||||
|
ev.project_info = ProjectInfo()
|
||||||
|
pi = ev.project_info
|
||||||
|
if pi.client is None: pi.client = cc.client
|
||||||
|
if pi.operator is None: pi.operator = cc.operator
|
||||||
|
if pi.sensor_location is None: pi.sensor_location = cc.sensor_location
|
||||||
|
if pi.notes is None: pi.notes = cc.notes
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"device": _serialise_device_info(info),
|
"device": _serialise_device_info(info),
|
||||||
"event_count": len(events),
|
"event_count": len(events),
|
||||||
|
|||||||
Reference in New Issue
Block a user