Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bases/rsptx/admin_server_api/routers/instructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ async def get_create_course_page(request: Request, user=Depends(auth_manager)):
course_list = await fetch_library_books()
# Convert LibraryValidator objects to dicts for template compatibility
course_list = [c.dict() for c in course_list if c.for_classes]
sections = sorted({c["shelf_section"] for c in course_list})
sections = sorted({c["shelf_section"] or "Misc" for c in course_list})
Comment on lines 1322 to +1323
context = {
"request": request,
"course_list": course_list,
Expand Down Expand Up @@ -1447,7 +1447,7 @@ async def post_create_course_page(
course_list = await fetch_library_books()
# Convert LibraryValidator objects to dicts for template compatibility
course_list = [c.dict() for c in course_list if c.for_classes]
sections = sorted({c["shelf_section"] for c in course_list})
sections = sorted({c["shelf_section"] or "Misc" for c in course_list})

context = {
"request": request,
Expand Down
4 changes: 3 additions & 1 deletion components/rsptx/db/crud/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ async def create_library_book(bookid: str, vals: Dict[str, Any]) -> None:
:param vals: Dict[str, Any], the dictionary containing the properties of the book
:return: None
"""
new_book = Library(**vals, basecourse=bookid)
book_vals = {"shelf_section": "Misc", **vals}
new_book = Library(**book_vals, basecourse=bookid)

async with async_session.begin() as session:
session.add(new_book)

Expand Down
Loading