feat: add swap functionality for unit and modem assignments in vibration monitoring locations

This commit is contained in:
2026-03-27 20:33:13 +00:00
parent 3c4b81cf78
commit ac48fb2977
4 changed files with 231 additions and 59 deletions

View File

@@ -355,8 +355,11 @@ async def nrl_detail_page(
).first()
assigned_unit = None
assigned_modem = None
if assignment:
assigned_unit = db.query(RosterUnit).filter_by(id=assignment.unit_id).first()
if assigned_unit and assigned_unit.deployed_with_modem_id:
assigned_modem = db.query(RosterUnit).filter_by(id=assigned_unit.deployed_with_modem_id).first()
# Get session count
session_count = db.query(MonitoringSession).filter_by(location_id=location_id).count()
@@ -393,6 +396,7 @@ async def nrl_detail_page(
"location": location,
"assignment": assignment,
"assigned_unit": assigned_unit,
"assigned_modem": assigned_modem,
"session_count": session_count,
"file_count": file_count,
"active_session": active_session,