diff --git a/build.py b/build.py index 82e9e85..05fdf2f 100644 --- a/build.py +++ b/build.py @@ -75,13 +75,29 @@ def scan_shared() -> list[Section]: assignments_dir = SHARED_DIR / "assignments" if assignments_dir.exists(): - zip_name = "assignments.zip" - create_zip(assignments_dir, ZIPS_DIR / zip_name) - sections.append(Section( - title="Assignments", - zip_url=f"zips/{zip_name}", - files=list_files(assignments_dir), - )) + subdirs = sorted( + d for d in assignments_dir.iterdir() + if d.is_dir() and should_include(d) + ) + if subdirs: + subsections = [] + for subdir in subdirs: + zip_name = f"assignments-{subdir.name}.zip" + create_zip(subdir, ZIPS_DIR / zip_name) + subsections.append(SubSection( + name=subdir.name, + zip_url=f"zips/{zip_name}", + files=list_files(subdir), + )) + sections.append(Section(title="Assignments", subsections=subsections)) + else: + zip_name = "assignments.zip" + create_zip(assignments_dir, ZIPS_DIR / zip_name) + sections.append(Section( + title="Assignments", + zip_url=f"zips/{zip_name}", + files=list_files(assignments_dir), + )) notes_dir = SHARED_DIR / "notes-and-examples" if notes_dir.exists(): diff --git a/shared/assignments/youtube-playlists.pdf b/shared/assignments/youtube-playlists/youtube-playlists.pdf similarity index 100% rename from shared/assignments/youtube-playlists.pdf rename to shared/assignments/youtube-playlists/youtube-playlists.pdf