ADR-013 Phase 3 complete: asset-panels + asset-presentation + map-overlays renderers
This commit is contained in:
@@ -363,13 +363,18 @@ def map_overlay():
|
||||
"""
|
||||
today = date.today()
|
||||
query = db.session.query(MeasuringTool).join(Asset).filter(Asset.isactive == True)
|
||||
# Overlay contract (ADR-010): [{assetid, color, label}] joined by assetid.
|
||||
# Only decorate tools that are actually due/overdue - a marker with no entry
|
||||
# gets no badge.
|
||||
data = []
|
||||
for tool in query.all():
|
||||
status = derive_status(tool.nextcalibrationdate, today)
|
||||
if status not in ('overdue', 'duesoon'):
|
||||
continue
|
||||
data.append({
|
||||
'assetid': tool.assetid,
|
||||
'calibrationstatus': status,
|
||||
'statuscolor': STATUS_COLORS.get(status, STATUS_COLORS['unknown']),
|
||||
'color': STATUS_COLORS.get(status, STATUS_COLORS['unknown']),
|
||||
'label': 'Overdue' if status == 'overdue' else 'Due soon',
|
||||
})
|
||||
return success_response(data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user