feat(activity): add --by-activity flag to break down spent time by activity type

- Load time entry activity names from Redmine enumeration.
- Aggregate hours per issue and per activity in fetch_issues_with_spent_time.
- Add --by-activity CLI flag and propagate it through report builder,
  summary, and all formatters (console, CSV, HTML, JSON, ODT).
- Keep backward-compatible 2-tuple input in build_grouped_report.
- Bump version to 1.8.0.

Closes #41
This commit is contained in:
Кокос Артем Николаевич
2026-06-29 16:44:52 +07:00
parent f6861382e6
commit 59af7ce464
12 changed files with 142 additions and 32 deletions

View File

@@ -12,13 +12,14 @@ class TableFormatter(Formatter):
def format(self, rows: List[ReportRow]) -> str:
table_rows = [["Проект", "Версия", "Задача", "Статус", "Затрачено"]]
for r in rows:
time_text = r["time_text"].replace("\n", " / ")
table_rows.append(
[
r["display_project"],
r["display_version"],
f"{r['issue_id']}. {r['subject']}",
r["status_ru"],
r["time_text"],
time_text,
]
)
return tabulate(table_rows, headers="firstrow", tablefmt="fancy_grid")
@@ -35,9 +36,10 @@ class CompactFormatter(Formatter):
def format(self, rows: List[ReportRow]) -> str:
lines = []
for r in rows:
time_text = r["time_text"].replace("\n", " / ")
lines.append(
f"{r['display_project']} | {r['display_version']} | "
f"{r['issue_id']}. {r['subject']} | {r['status_ru']} | {r['time_text']}"
f"{r['issue_id']}. {r['subject']} | {r['status_ru']} | {time_text}"
)
return "\n".join(lines)