05/29 Update customer Inspections and Issues contract filter

This commit is contained in:
2026-05-29 09:29:31 -04:00
parent 1093410d74
commit 38eb77a441
2 changed files with 22 additions and 4 deletions
+10 -1
View File
@@ -249,7 +249,16 @@ def index():
facilities = _fq.order_by(Facility.name).all() facilities = _fq.order_by(Facility.name).all()
from app.models.project import Project from app.models.project import Project, CustomerAssignment
if current_user.role == 'customer':
assigned_pids = {
a.project_id for a in
CustomerAssignment.query.filter_by(user_id=current_user.id).all()
}
projects = Project.query.filter(
Project.active == True, Project.id.in_(assigned_pids)
).order_by(Project.name).all()
else:
projects = Project.query.filter_by(active=True).order_by(Project.name).all() projects = Project.query.filter_by(active=True).order_by(Project.name).all()
return render_template('inspections/list.html', return render_template('inspections/list.html',
+10 -1
View File
@@ -169,7 +169,16 @@ def index():
facilities = _fq.order_by(Facility.name).all() facilities = _fq.order_by(Facility.name).all()
from app.models.project import Project from app.models.project import Project, CustomerAssignment
if current_user.role == 'customer':
assigned_pids = {
a.project_id for a in
CustomerAssignment.query.filter_by(user_id=current_user.id).all()
}
projects = Project.query.filter(
Project.active == True, Project.id.in_(assigned_pids)
).order_by(Project.name).all()
else:
projects = Project.query.filter_by(active=True).order_by(Project.name).all() projects = Project.query.filter_by(active=True).order_by(Project.name).all()
# Staff for quick-assign dropdown — same roles as the full issue form # Staff for quick-assign dropdown — same roles as the full issue form