1차완료

This commit is contained in:
byun
2026-06-02 19:34:36 +09:00
parent 9f0f4326fe
commit b6863cd260
28 changed files with 1667 additions and 460 deletions

View File

@@ -36,6 +36,16 @@ def _fmt_repair(repair: models.Repair) -> dict:
"issue_types": r.issue_types,
"status": r.status,
})
# 같은 신고에 연결된 조치 목록에서 현재 조치의 순번 계산 (오래된 것=1차)
attempt = 1
if repair.report_links:
first_report = repair.report_links[0].report
if first_report and first_report.repair_links:
all_repair_ids = sorted(rl.repair_id for rl in first_report.repair_links)
if repair.id in all_repair_ids:
attempt = all_repair_ids.index(repair.id) + 1
return {
"id": repair.id,
"charger_id": charger_id,
@@ -56,6 +66,7 @@ def _fmt_repair(repair: models.Repair) -> dict:
"photos_after": [{"id": p.id, "path": p.file_path} for p in repair.photos if p.photo_type == "after"],
"reports": reports,
"report_count": len(reports),
"attempt": attempt,
}