Auto-commit local changes before build (2026-01-20 10:44:53)

This commit is contained in:
Ivo Oskamp 2026-01-20 10:44:53 +01:00
parent e4e069a6b3
commit 899863a0de
3 changed files with 36 additions and 76 deletions

View File

@ -1 +1 @@
v20260120-05-autotask-indent-fix
v20260120-06-routes-inbox-indent-fix

View File

@ -529,6 +529,7 @@ def inbox_message_approve_vspc_companies(message_id: int):
# De-duplicate: do not create multiple runs for the same (mail_message_id, job_id).
run = JobRun.query.filter(JobRun.job_id == job.id, JobRun.mail_message_id == msg.id).first()
created = False
if run:
skipped_existing += 1
else:
@ -541,24 +542,17 @@ def inbox_message_approve_vspc_companies(message_id: int):
)
if hasattr(run, "remark"):
run.remark = getattr(msg, "overall_message", None)
db.session.add(run)
created = True
# Ensure we have IDs before linking tickets or persisting objects.
db.session.flush()
try:
link_open_internal_tickets_to_run(run=run, job=job)
except Exception:
pass
db.session.flush()
try:
link_open_internal_tickets_to_run(run=run, job=job)
except Exception:
pass
db.session.flush()
try:
link_open_internal_tickets_to_run(run=run, job=job)
except Exception:
pass
db.session.flush()
if created:
created_runs.append(run)
# Persist objects for reporting (idempotent upsert; safe to repeat).
@ -704,22 +698,12 @@ def inbox_message_approve_vspc_companies(message_id: int):
if hasattr(run2, "remark"):
run2.remark = getattr(other, "overall_message", None)
db.session.add(run2)
db.session.flush()
try:
link_open_internal_tickets_to_run(run=run2, job=job)
link_open_internal_tickets_to_run(run=run2, job=job2)
except Exception:
pass
db.session.flush()
try:
link_open_internal_tickets_to_run(run=run2, job=job)
except Exception:
pass
db.session.flush()
try:
link_open_internal_tickets_to_run(run=run2, job=job)
except Exception:
pass
db.session.flush()
# Persist objects per company
try:
@ -1085,22 +1069,12 @@ def inbox_reparse_all():
run.storage_free_percent = msg.storage_free_percent
db.session.add(run)
db.session.flush()
try:
link_open_internal_tickets_to_run(run=run, job=job)
except Exception:
pass
db.session.flush()
try:
link_open_internal_tickets_to_run(run=run, job=job)
except Exception:
pass
db.session.flush()
try:
link_open_internal_tickets_to_run(run=run, job=job)
except Exception:
pass
db.session.flush()
auto_approved_runs.append((job.customer_id, job.id, run.id, msg.id))
created_any = True
@ -1160,22 +1134,11 @@ def inbox_reparse_all():
run.storage_free_percent = msg.storage_free_percent
db.session.add(run)
db.session.flush()
try:
link_open_internal_tickets_to_run(run=run, job=job)
except Exception:
pass
db.session.flush()
try:
link_open_internal_tickets_to_run(run=run, job=job)
except Exception:
pass
db.session.flush()
try:
link_open_internal_tickets_to_run(run=run, job=job)
except Exception:
pass
db.session.flush() # ensure run.id is available
try:
link_open_internal_tickets_to_run(run=run, job=job)
except Exception:
pass
auto_approved_runs.append((job.customer_id, job.id, run.id, msg.id))
msg.job_id = job.id
@ -1279,17 +1242,6 @@ def inbox_reparse_all():
link_open_internal_tickets_to_run(run=run, job=job)
except Exception:
pass
db.session.flush()
try:
link_open_internal_tickets_to_run(run=run, job=job)
except Exception:
pass
db.session.flush()
try:
link_open_internal_tickets_to_run(run=run, job=job)
except Exception:
pass
db.session.flush()
auto_approved_runs.append((job.customer_id, job.id, run.id, msg.id))
msg.job_id = job.id

View File

@ -400,6 +400,14 @@ Changes:
- Corrected the indentation of db.session.flush() to restore valid Python syntax.
- No functional or logical changes were made.
## v20260120-06-routes-inbox-indent-fix
### Changes:
- Fixed multiple indentation and syntax errors in routes_inbox.py.
- Corrected misaligned db.session.flush() calls to ensure proper transaction handling.
- Repaired indentation of link_open_internal_tickets_to_run logic to prevent runtime exceptions.
- Restored application startup stability by resolving Python IndentationError issues.
***
## v0.1.21