Aug 6 - Add external inspector role
This commit is contained in:
@@ -82,7 +82,8 @@ def _populate_choices(form):
|
||||
facilities = Facility.query.filter_by(active=True).order_by(Facility.name).all()
|
||||
templates = (InspectionTemplate.query
|
||||
.filter_by(active=True).order_by(InspectionTemplate.name).all())
|
||||
inspectors = (User.query.filter_by(role='inspector', active=True)
|
||||
inspectors = (User.query.filter(User.role.in_(User.INSPECTOR_ROLES),
|
||||
User.active == True)
|
||||
.order_by(User.username).all())
|
||||
form.facility_id.choices = [(f.id, f.name) for f in facilities]
|
||||
form.template_id.choices = [(t.id, t.name) for t in templates]
|
||||
@@ -236,7 +237,7 @@ def index():
|
||||
base = ScheduledInspection.query
|
||||
|
||||
# Inspectors see only their own assignments; managers see everything.
|
||||
if current_user.role == 'inspector':
|
||||
if current_user.is_inspector:
|
||||
base = base.filter(ScheduledInspection.inspector_id == current_user.id)
|
||||
|
||||
pending_count = base.filter(ScheduledInspection.active.is_(True)).count()
|
||||
|
||||
Reference in New Issue
Block a user