06/11 Update Inspections page: add status filter (has follow-up, flagged issue)
This commit is contained in:
@@ -238,7 +238,15 @@ def index():
|
||||
score_max_filter = request.args.get('score_max', '')
|
||||
inspector_filter = request.args.get('inspector_id', '')
|
||||
|
||||
if status_filter:
|
||||
if status_filter == 'follow_up':
|
||||
q = q.filter(
|
||||
Inspection.follow_up_required == True,
|
||||
Inspection.status == 'completed',
|
||||
).filter(~Inspection.follow_ups.any())
|
||||
elif status_filter == 'has_issues':
|
||||
from sqlalchemy import exists as sa_exists
|
||||
q = q.filter(sa_exists().where(Issue.inspection_id == Inspection.id))
|
||||
elif status_filter:
|
||||
q = q.filter(Inspection.status == status_filter)
|
||||
if contract_filter.isdigit():
|
||||
_contract_fids = [
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
{% for s in ['in_progress','completed','flagged'] %}
|
||||
<option value="{{ s }}" {% if status_filter == s %}selected{% endif %}>{{ 'Submitted' if s == 'completed' else s|replace('_',' ')|title }}</option>
|
||||
{% endfor %}
|
||||
<option value="follow_up" {% if status_filter == 'follow_up' %}selected{% endif %}>Flagged Follow-up</option>
|
||||
<option value="has_issues" {% if status_filter == 'has_issues' %}selected{% endif %}>Has Logged Issues</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
|
||||
Reference in New Issue
Block a user