Enum 값 및 필드명 수정, 한글 파일명 처리 개선
- Enum 값을 소문자로 변경 (material_missing, design_error, incoming_defect, complete) - nonconformity_name -> description 필드명 변경 - completion_date -> actual_completion_date 필드명 변경 - Excel 다운로드 시 한글 파일명 URL 인코딩 추가 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -53,15 +53,15 @@ async def generate_report_summary(
|
|||||||
|
|
||||||
for issue in issues:
|
for issue in issues:
|
||||||
# 카테고리별 카운트
|
# 카테고리별 카운트
|
||||||
if issue.category == IssueCategory.MATERIAL_MISSING:
|
if issue.category == IssueCategory.material_missing:
|
||||||
category_stats.material_missing += 1
|
category_stats.material_missing += 1
|
||||||
elif issue.category == IssueCategory.DIMENSION_DEFECT:
|
elif issue.category == IssueCategory.design_error:
|
||||||
category_stats.dimension_defect += 1
|
category_stats.dimension_defect += 1
|
||||||
elif issue.category == IssueCategory.INCOMING_DEFECT:
|
elif issue.category == IssueCategory.incoming_defect:
|
||||||
category_stats.incoming_defect += 1
|
category_stats.incoming_defect += 1
|
||||||
|
|
||||||
# 완료된 이슈
|
# 완료된 이슈
|
||||||
if issue.status == IssueStatus.COMPLETE:
|
if issue.status == IssueStatus.complete:
|
||||||
completed_issues += 1
|
completed_issues += 1
|
||||||
if issue.work_hours > 0:
|
if issue.work_hours > 0:
|
||||||
total_resolution_time += issue.work_hours
|
total_resolution_time += issue.work_hours
|
||||||
@@ -237,7 +237,7 @@ async def export_daily_report(
|
|||||||
|
|
||||||
ws.cell(row=current_row, column=1, value=issue.id)
|
ws.cell(row=current_row, column=1, value=issue.id)
|
||||||
ws.cell(row=current_row, column=2, value=project.project_name)
|
ws.cell(row=current_row, column=2, value=project.project_name)
|
||||||
ws.cell(row=current_row, column=3, value=issue.nonconformity_name or "")
|
ws.cell(row=current_row, column=3, value=issue.description or "")
|
||||||
ws.cell(row=current_row, column=4, value=issue.detail_notes or "")
|
ws.cell(row=current_row, column=4, value=issue.detail_notes or "")
|
||||||
ws.cell(row=current_row, column=5, value=get_category_text(issue.category))
|
ws.cell(row=current_row, column=5, value=get_category_text(issue.category))
|
||||||
ws.cell(row=current_row, column=6, value=issue.solution or "")
|
ws.cell(row=current_row, column=6, value=issue.solution or "")
|
||||||
@@ -246,7 +246,7 @@ async def export_daily_report(
|
|||||||
ws.cell(row=current_row, column=9, value=issue.expected_completion_date.strftime('%Y-%m-%d') if issue.expected_completion_date else "")
|
ws.cell(row=current_row, column=9, value=issue.expected_completion_date.strftime('%Y-%m-%d') if issue.expected_completion_date else "")
|
||||||
ws.cell(row=current_row, column=10, value=get_status_text(issue.review_status))
|
ws.cell(row=current_row, column=10, value=get_status_text(issue.review_status))
|
||||||
ws.cell(row=current_row, column=11, value=issue.report_date.strftime('%Y-%m-%d') if issue.report_date else "")
|
ws.cell(row=current_row, column=11, value=issue.report_date.strftime('%Y-%m-%d') if issue.report_date else "")
|
||||||
ws.cell(row=current_row, column=12, value=issue.completion_date.strftime('%Y-%m-%d') if issue.completion_date else "")
|
ws.cell(row=current_row, column=12, value=issue.actual_completion_date.strftime('%Y-%m-%d') if issue.actual_completion_date else "")
|
||||||
|
|
||||||
# 상태별 색상 적용
|
# 상태별 색상 적용
|
||||||
status_color = get_status_color(issue.review_status)
|
status_color = get_status_color(issue.review_status)
|
||||||
@@ -282,10 +282,16 @@ async def export_daily_report(
|
|||||||
today = date.today().strftime('%Y%m%d')
|
today = date.today().strftime('%Y%m%d')
|
||||||
filename = f"{project.project_name}_일일보고서_{today}.xlsx"
|
filename = f"{project.project_name}_일일보고서_{today}.xlsx"
|
||||||
|
|
||||||
|
# 한글 파일명을 위한 URL 인코딩
|
||||||
|
from urllib.parse import quote
|
||||||
|
encoded_filename = quote(filename.encode('utf-8'))
|
||||||
|
|
||||||
return StreamingResponse(
|
return StreamingResponse(
|
||||||
io.BytesIO(excel_buffer.read()),
|
io.BytesIO(excel_buffer.read()),
|
||||||
media_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
media_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||||
headers={"Content-Disposition": f"attachment; filename={filename}"}
|
headers={
|
||||||
|
"Content-Disposition": f"attachment; filename*=UTF-8''{encoded_filename}"
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def calculate_project_stats(issues: List[Issue]) -> schemas.DailyReportStats:
|
def calculate_project_stats(issues: List[Issue]) -> schemas.DailyReportStats:
|
||||||
|
|||||||
Reference in New Issue
Block a user