more complex
This commit is contained in:
@@ -8,7 +8,7 @@ sys.path.insert(0, os.path.join(_ROOT, "app"))
|
||||
sys.path.insert(0, os.path.join(_ROOT, "controller"))
|
||||
|
||||
from xlsx_grid_helper import build_grid_sheet, new_workbook, save_workbook # noqa: E402
|
||||
from template_controller import TIME_SLOTS as GRID_TIME_SLOTS # noqa: E402
|
||||
from template_controller import DISPLAY_ROWS # noqa: E402
|
||||
|
||||
|
||||
def _sessions_for_batch(sessions, batch_code):
|
||||
@@ -28,10 +28,10 @@ def generate_batch_wise_templates(sessions, data, output_dir):
|
||||
by_day_slot = {}
|
||||
for s in batch_sessions:
|
||||
for slot_index in s["slot_indices"]:
|
||||
by_day_slot.setdefault((s["day"], slot_index), []).append(s)
|
||||
by_day_slot.setdefault((s["day"], slot_index, s["duration_minutes"]), []).append(s)
|
||||
|
||||
def cell_text(day, slot_index, by_day_slot=by_day_slot):
|
||||
entries = by_day_slot.get((day, slot_index))
|
||||
def cell_text(day, slot_index, duration_minutes, by_day_slot=by_day_slot):
|
||||
entries = by_day_slot.get((day, slot_index, duration_minutes))
|
||||
if not entries:
|
||||
return ""
|
||||
lines = []
|
||||
@@ -49,8 +49,8 @@ def generate_batch_wise_templates(sessions, data, output_dir):
|
||||
ws,
|
||||
title=f"Batch {batch_code}",
|
||||
subtitle=subtitle,
|
||||
time_slots=GRID_TIME_SLOTS,
|
||||
sessions_by_day_slot=first_by_day_slot,
|
||||
display_rows=DISPLAY_ROWS,
|
||||
sessions_by_cell=first_by_day_slot,
|
||||
cell_text_fn=cell_text,
|
||||
)
|
||||
path = save_workbook(wb, output_dir, f"{batch_code}.xlsx")
|
||||
|
||||
Reference in New Issue
Block a user