05/29 Update customer Inspections and Issues contract filter
This commit is contained in:
@@ -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
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user