more complex

This commit is contained in:
Talhadeveloperr
2026-09-09 18:29:08 +05:00
parent 0f1e3adbb1
commit 868bcbe175
266 changed files with 2825 additions and 137 deletions

View File

@@ -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 generate_department_wise_templates(sessions, data, output_dir):
@@ -22,10 +22,10 @@ def generate_department_wise_templates(sessions, data, output_dir):
by_day_slot = {}
for s in dept_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 = []
@@ -44,8 +44,8 @@ def generate_department_wise_templates(sessions, data, output_dir):
ws,
title=f"Department: {department}",
subtitle="All batches / programs",
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"{department}.xlsx")