Updater
This commit is contained in:
24
BABA_YAGA_Updater/mappers/markdown_builder.py
Normal file
24
BABA_YAGA_Updater/mappers/markdown_builder.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from core.models import ProgressReport
|
||||
|
||||
class MarkdownBuilder:
|
||||
@staticmethod
|
||||
def build_table(report: ProgressReport) -> str:
|
||||
if not report.tasks:
|
||||
return "_No tasks updated._"
|
||||
|
||||
header = "| Category | Task | Status | Progress | Notes |\n"
|
||||
separator = "| :--- | :--- | :--- | :--- | :--- |\n"
|
||||
rows = []
|
||||
|
||||
for task in report.tasks:
|
||||
# Format status with some icons if possible, or just plain text
|
||||
status_text = task.status
|
||||
if "done" in status_text.lower() or "complete" in status_text.lower():
|
||||
status_text = f"✅ {status_text}"
|
||||
elif "progress" in status_text.lower():
|
||||
status_text = f"🔄 {status_text}"
|
||||
|
||||
row = f"| {task.category} | {task.task_name} | {status_text} | {task.progress} | {task.notes} |"
|
||||
rows.append(row)
|
||||
|
||||
return header + separator + "\n".join(rows)
|
||||
20
BABA_YAGA_Updater/mappers/sheet_mapper.py
Normal file
20
BABA_YAGA_Updater/mappers/sheet_mapper.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from core.models import Task, ProgressReport
|
||||
|
||||
class SheetMapper:
|
||||
@staticmethod
|
||||
def map_rows_to_report(rows: list[list]) -> ProgressReport:
|
||||
tasks = []
|
||||
for row in rows:
|
||||
# Ensure the row has enough columns, fill missing with empty strings
|
||||
padded_row = row + [""] * (5 - len(row))
|
||||
|
||||
task = Task(
|
||||
category=padded_row[0],
|
||||
task_name=padded_row[1],
|
||||
status=padded_row[2],
|
||||
progress=padded_row[3],
|
||||
notes=padded_row[4]
|
||||
)
|
||||
tasks.append(task)
|
||||
|
||||
return ProgressReport(tasks=tasks)
|
||||
Reference in New Issue
Block a user