Commit prior to form response checking pivot in logic

This commit is contained in:
2026-05-04 11:17:14 +10:00
parent cf395091a8
commit 74c73883c9
3 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ from fastapi.responses import HTMLResponse
DB_PATH = os.getenv("WEBHOOK_DB_PATH", "./servicem8_webhooks.db")
STATE_DB_PATH = os.getenv("WEBHOOK_STATE_DB_PATH", "./servicem8_quote_materials_state.db")
APP_HOST = os.getenv("WEBHOOK_INSPECTOR_HOST", "127.0.0.1")
APP_HOST = os.getenv("WEBHOOK_INSPECTOR_HOST", "0.0.0.0")
APP_PORT = int(os.getenv("WEBHOOK_INSPECTOR_PORT", "18355"))
PAGE_SIZE = 50
+6
View File
@@ -145,6 +145,7 @@ def build_job_material_line(
def parse_quote_template_field_rows(field_rows: List[Dict[str, Any]]) -> Dict[str, Any]:
ordered = sorted(field_rows, key=sort_key)
description = ""
author_name = ""
include_items: List[Dict[str, Any]] = []
exclude_items: List[Dict[str, Any]] = []
extra_include_items: List[Dict[str, Any]] = []
@@ -161,6 +162,10 @@ def parse_quote_template_field_rows(field_rows: List[Dict[str, Any]]) -> Dict[st
description = response
continue
if question == "Name":
author_name = response
continue
if question.startswith("Item ") and response:
include_items.append(
{
@@ -253,6 +258,7 @@ def parse_quote_template_field_rows(field_rows: List[Dict[str, Any]]) -> Dict[st
return {
"description": description,
"author_name": author_name,
"include_items": include_items,
"extra_include_items": extra_include_items,
"exclude_items": exclude_items,
+1
View File
@@ -170,6 +170,7 @@ def queue_quote_template_jobmaterials(payload, received_at: str):
"form_uuid": form_uuid,
"form_response_uuid": parsed.get("form_response_uuid", ""),
"job_uuid": parsed.get("job_uuid", ""),
"author_name": parsed.get("author_name", ""),
"description": parsed.get("description", ""),
"desired_job_materials": parsed.get("desired_job_materials", []),
}