diff --git a/.gitignore b/.gitignore index b697ede..fd12ceb 100644 --- a/.gitignore +++ b/.gitignore @@ -211,3 +211,4 @@ __marimo__/ *.db *.db-journal data/ +.aider* diff --git a/backend/routers/project_locations.py b/backend/routers/project_locations.py index 0f999c9..37312e2 100644 --- a/backend/routers/project_locations.py +++ b/backend/routers/project_locations.py @@ -152,6 +152,8 @@ async def update_location( location.name = data["name"] if "description" in data: location.description = data["description"] + if "location_type" in data: + location.location_type = data["location_type"] if "coordinates" in data: location.coordinates = data["coordinates"] if "address" in data: diff --git a/backend/routers/slm_dashboard.py b/backend/routers/slm_dashboard.py index d2e4408..9107b3c 100644 --- a/backend/routers/slm_dashboard.py +++ b/backend/routers/slm_dashboard.py @@ -61,13 +61,9 @@ async def get_slm_stats(request: Request, db: Session = Depends(get_db)): async def get_slm_units( request: Request, db: Session = Depends(get_db), -<<<<<<< Updated upstream - search: str = Query(None) -======= search: str = Query(None), project: str = Query(None), include_measurement: bool = Query(False), ->>>>>>> Stashed changes ): """ Get list of SLM units for the sidebar. @@ -75,6 +71,10 @@ async def get_slm_units( """ query = db.query(RosterUnit).filter_by(device_type="sound_level_meter") + # Filter by project if provided + if project: + query = query.filter(RosterUnit.project_id == project) + # Filter by search term if provided if search: search_term = f"%{search}%" diff --git a/templates/partials/projects/assignment_list.html b/templates/partials/projects/assignment_list.html new file mode 100644 index 0000000..8b75c7a --- /dev/null +++ b/templates/partials/projects/assignment_list.html @@ -0,0 +1,30 @@ + +{% if assignments %} +
{{ item.unit.id if item.unit else item.assignment.unit_id }}
+ {% if item.location %} +Location: {{ item.location.name }}
+ {% endif %} ++ Assigned: {% if item.assignment.assigned_at %}{{ item.assignment.assigned_at.strftime('%Y-%m-%d %H:%M') }}{% else %}Unknown{% endif %} +
+No active assignments
+{{ item.location.name }}
+ {% if item.location.location_type %} + + {{ item.location.location_type|capitalize }} + + {% endif %} +{{ item.location.description }}
+ {% endif %} + {% if item.location.address %} +{{ item.location.address }}
+ {% endif %} + {% if item.location.coordinates %} +{{ item.location.coordinates }}
+ {% endif %} +No locations added yet
+{{ location.name }}
- {% if location.address %} -{{ location.address }}
- {% endif %} - {% if location.coordinates %} -{{ location.coordinates }}
- {% endif %} -No locations added yet.
- {% endif %} -{{ item.unit.id }}
- {% if item.unit.slm_model %} -{{ item.unit.slm_model }}
- {% endif %} - {% if item.unit.address %} -{{ item.unit.address }}
- {% endif %} - - {% endfor %} -No units assigned yet.
- {% endif %} +Sound monitoring project overview and assignments
Update project details and status
+Create or update a monitoring location
+Attach a device to this location
+