31 lines
844 B
Python
31 lines
844 B
Python
from typing import List
|
|
from tabulate import tabulate
|
|
from .types import ReportRow
|
|
|
|
|
|
def format_compact(rows: List[ReportRow]) -> str:
|
|
lines = []
|
|
|
|
for r in rows:
|
|
lines.append(
|
|
f"{r['display_project']} | {r['display_version']} | "
|
|
f"{r['issue_id']}. {r['subject']} | {r['status_ru']} | {r['time_text']}"
|
|
)
|
|
|
|
return "\n".join(lines)
|
|
|
|
|
|
def format_table(rows: List[ReportRow]) -> str:
|
|
table_rows = [['Проект', 'Версия', 'Задача', 'Статус', 'Затрачено']]
|
|
|
|
for r in rows:
|
|
table_rows.append([
|
|
r['display_project'],
|
|
r['display_version'],
|
|
f"{r['issue_id']}. {r['subject']}",
|
|
r['status_ru'],
|
|
r['time_text']
|
|
])
|
|
|
|
return tabulate(table_rows, headers="firstrow", tablefmt="fancy_grid")
|