Aug 19 - Fix New Inspection Internal Server error

This commit is contained in:
2026-08-19 14:51:16 -04:00
parent 88af636912
commit 291d566f17
3 changed files with 10 additions and 2 deletions
+1
View File
@@ -42,6 +42,7 @@ from app.models.inspection_schedule import (InspectionSchedule,
DEFAULT_RUN_HOUR) DEFAULT_RUN_HOUR)
from app.models.inspection import Inspection, InspectionTemplate from app.models.inspection import Inspection, InspectionTemplate
from app.models.facility import Facility, Area from app.models.facility import Facility, Area
from app.models.project import Project
from app.models.user import User from app.models.user import User
from functools import wraps from functools import wraps
from app.utils.decorators import project_manager_required from app.utils.decorators import project_manager_required
+2 -1
View File
@@ -9,7 +9,6 @@
the auto/plan MODE. They are placed next to the field they qualify rather the auto/plan MODE. They are placed next to the field they qualify rather
than in a block of their own. #} than in a block of their own. #}
{% block content %}
{# ── Sticky values ──────────────────────────────────────────────────────── {# ── Sticky values ────────────────────────────────────────────────────────
This form is hand-built (no WTForms), so a re-render after a validation This form is hand-built (no WTForms), so a re-render after a validation
error would otherwise come back blank and the user would retype everything. error would otherwise come back blank and the user would retype everything.
@@ -33,6 +32,8 @@
{% set v_nth_weekday = (posted.get('nth_weekday')|int(-1)) if posted else (schedule.nth_weekday if schedule and schedule.nth_weekday is not none else -1) %} {% set v_nth_weekday = (posted.get('nth_weekday')|int(-1)) if posted else (schedule.nth_weekday if schedule and schedule.nth_weekday is not none else -1) %}
{% set v_weekdays = (posted.getlist('weekdays')|map('int')|list) if posted else (schedule.weekday_list if schedule else []) %} {% set v_weekdays = (posted.getlist('weekdays')|map('int')|list) if posted else (schedule.weekday_list if schedule else []) %}
{% set v_active = (posted.get('active') is not none) if posted else (schedule.active if schedule else True) %} {% set v_active = (posted.get('active') is not none) if posted else (schedule.active if schedule else True) %}
{% block content %}
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-lg-7"> <div class="col-lg-7">
<div class="card shadow-sm"> <div class="card shadow-sm">
+7 -1
View File
@@ -1,6 +1,13 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}Inspection #{{ inspection.id }} — Results{% endblock %} {% block title %}Inspection #{{ inspection.id }} — Results{% endblock %}
{# The filtered list URL this page was opened from. Defined at TOP LEVEL, not
inside the content block: Jinja blocks do not share scope, and the follow-up
modal below sits in the extra_js block — from there a content-scoped
back_url is Undefined and posts next="", silently dropping the very filters
this mechanism exists to preserve. #}
{% set back_url = request.args.get('next') or url_for('inspections.index') %}
{% block extra_css %} {% block extra_css %}
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&display=swap" rel="stylesheet">
<style> <style>
@@ -341,7 +348,6 @@
{# `next` carries the filtered list URL from the list page; the {# `next` carries the filtered list URL from the list page; the
sessionStorage fallback below still covers links opened before sessionStorage fallback below still covers links opened before
this page started sending one. #} this page started sending one. #}
{% set back_url = request.args.get('next') or url_for('inspections.index') %}
<a id="backToInspectionsBtn" href="{{ back_url }}" class="btn btn-sm btn-outline-secondary"> <a id="backToInspectionsBtn" href="{{ back_url }}" class="btn btn-sm btn-outline-secondary">
<i class="bi bi-arrow-left"></i> Back to Inspections <i class="bi bi-arrow-left"></i> Back to Inspections
</a> </a>