March 17 2026: santinize code
This commit is contained in:
@@ -477,26 +477,7 @@ def view(inspection_id):
|
||||
parent_form_data = parsed_p.get('_form_data', {})
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
pass
|
||||
'''
|
||||
# ── DEBUG: log raw schema + form_data so we can see what's actually stored ──
|
||||
current_app.logger.warning(
|
||||
'COMPARISON DEBUG | inspection_id=%s | current_form_data=%s',
|
||||
inspection_id, json.dumps(form_data)
|
||||
)
|
||||
current_app.logger.warning(
|
||||
'COMPARISON DEBUG | parent_id=%s | parent_form_data=%s',
|
||||
parent.id, json.dumps(parent_form_data)
|
||||
)
|
||||
current_app.logger.warning(
|
||||
'COMPARISON DEBUG | form_fields=%s',
|
||||
json.dumps([
|
||||
{'id': f.get('id'), 'type': f.get('type'), 'row': f.get('row'),
|
||||
'col': f.get('col'), 'label': f.get('label'), 'text_content': f.get('text_content')}
|
||||
for f in form_fields
|
||||
])
|
||||
)
|
||||
# ── END DEBUG ──
|
||||
'''
|
||||
|
||||
scoreable_types = ('rating', 'checkbox', 'radio')
|
||||
|
||||
# Collect all text/textarea fields per row, keyed by (col, fid)
|
||||
|
||||
+3
-12
@@ -117,14 +117,6 @@ def view(issue_id):
|
||||
form.assigned_to.choices = [(0, '— Unassigned —')] + [(u.id, u.username) for u in staff]
|
||||
form.status.data = form.status.data or issue.status
|
||||
|
||||
# Extend status choices to include pending_verification
|
||||
form.status.choices = [
|
||||
('open', 'Open'),
|
||||
('in_progress', 'In Progress'),
|
||||
('pending_verification', 'Pending Verification'),
|
||||
('resolved', 'Resolved'),
|
||||
]
|
||||
|
||||
if form.validate_on_submit():
|
||||
old_status = issue.status
|
||||
old_assigned_to = issue.assigned_to
|
||||
@@ -424,6 +416,8 @@ def create():
|
||||
flash('Issue created.', 'success')
|
||||
return redirect(url_for('issues.index'))
|
||||
|
||||
return render_template('issues/form.html', form=form, title='Log New Issue')
|
||||
|
||||
|
||||
# ── Supervisor verify resolved issue ─────────────────────────────────────────
|
||||
|
||||
@@ -554,7 +548,4 @@ def verification_queue():
|
||||
total_pending = len(pending),
|
||||
sla_status = sla_status,
|
||||
sla_hours_remaining = sla_hours_remaining,
|
||||
)
|
||||
|
||||
|
||||
return render_template('issues/form.html', form=form, title='Log New Issue')
|
||||
)
|
||||
@@ -110,7 +110,8 @@ def _build_report_data(report: ScheduledReport, start: datetime, end: datetime)
|
||||
Inspection.status == 'completed',
|
||||
Inspection.overall_score.isnot(None),
|
||||
)
|
||||
data['avg_score'] = round(float(_si(avg).scalar()), 2) if _si(avg).scalar() else None
|
||||
avg_val = _si(avg).scalar()
|
||||
data['avg_score'] = round(float(avg_val), 2) if avg_val else None
|
||||
|
||||
data['open_issues'] = _iq(Issue.query.filter(
|
||||
Issue.status.in_(['open', 'in_progress'])
|
||||
@@ -392,4 +393,4 @@ def send():
|
||||
|
||||
logger.info('SCHEDULED REPORTS CRON | frequency=%s | due=%s | sent=%s | failed=%s',
|
||||
frequency, len(due), sent, failed)
|
||||
return jsonify({'ok': True, 'frequency': frequency, 'sent': sent, 'failed': failed})
|
||||
return jsonify({'ok': True, 'frequency': frequency, 'sent': sent, 'failed': failed})
|
||||
@@ -84,11 +84,6 @@
|
||||
<a class="nav-link" href="{{ url_for('scheduled_reports.index') }}">Scheduled Reports</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if current_user.role in ['admin','supervisor'] %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('scheduled_reports.index') }}">Scheduled Reports</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('issues.index') }}">Issues</a>
|
||||
</li>
|
||||
|
||||
+3
-2
@@ -167,7 +167,8 @@ class IssueForm(FlaskForm):
|
||||
|
||||
class IssueUpdateForm(FlaskForm):
|
||||
status = SelectField('Status', choices=[
|
||||
('open','Open'), ('in_progress','In Progress'), ('resolved','Resolved'),
|
||||
('open','Open'), ('in_progress','In Progress'),
|
||||
('pending_verification','Pending Verification'), ('resolved','Resolved'),
|
||||
], validators=[DataRequired()])
|
||||
assigned_to = SelectField('Assign To', coerce=int, validators=[Optional()])
|
||||
update_notes = TextAreaField('Update Notes', validators=[Optional(), Length(max=1000)])
|
||||
@@ -222,4 +223,4 @@ class CustomerUserForm(FlaskForm):
|
||||
def validate_password(self, field):
|
||||
"""Password is required when creating a new account."""
|
||||
if self._user is None and not field.data:
|
||||
raise ValidationError('Password is required for new accounts.')
|
||||
raise ValidationError('Password is required for new accounts.')
|
||||
@@ -33,7 +33,7 @@ class Config:
|
||||
|
||||
# ── File uploads ────────────────────────────────────────────────────────
|
||||
UPLOAD_FOLDER = os.path.join(basedir, 'app/static/uploads')
|
||||
MAX_CONTENT_LENGTH = 50 * 1024 * 1024 # 16 MB
|
||||
MAX_CONTENT_LENGTH = 50 * 1024 * 1024 # 50 MB
|
||||
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}
|
||||
|
||||
# ── Session / cookies ───────────────────────────────────────────────────
|
||||
|
||||
+2
-1
@@ -11,4 +11,5 @@ Pillow
|
||||
WTForms
|
||||
email-validator
|
||||
gunicorn
|
||||
pytz
|
||||
reportlab
|
||||
pytz
|
||||
Reference in New Issue
Block a user