育儿假天改为小时显示

This commit is contained in:
runny committed 2026-05-28 09:09:52 +08:00
1 parent d85736de71
commit 24f99070a3
1 file changed
+4 -4
+4 -4
View File
@@ -210,12 +210,12 @@ WHERE c002001 = ?
return str(datetime.now().year)
@classmethod
def _render_table_row(cls, index: int, title: str, record: dict | None, requested_year: int | None) -> str:
def _render_table_row(cls, index: int, title: str, record: dict | None, requested_year: int | None, quota_unit: str = "天") -> str:
response_year = cls._resolve_response_year(record, requested_year)
if not record:
return f"| {index} | {title} | {response_year} | 暂无数据 | 暂无数据 | 暂无数据 |"
total = cls._format_quota(record.get('total_hours'))
used = cls._format_quota(record.get('used_hours'))
total = cls._format_quota(record.get('total_hours'), quota_unit)
used = cls._format_quota(record.get('used_hours'), quota_unit)
remaining = cls._format_quota(record.get('remaining_hours'), "小时")
return f"| {index} | {title} | {response_year} | {total} | {used} | {remaining} |"
@@ -249,7 +249,7 @@ WHERE c002001 = ?
sections.append(cls._render_table_row(index, "年假", annual_record, requested_year))
index += 1
if leave_type in ("childcare", "all"):
sections.append(cls._render_table_row(index, "育儿假", childcare_record, requested_year))
sections.append(cls._render_table_row(index, "育儿假", childcare_record, requested_year, "小时"))
index += 1
sections.extend(