1차완료
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user