Skip to content

Commit

Permalink
Sort segments by name in the API
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospri committed Nov 19, 2024
1 parent d54f0c0 commit 58c5967
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lms/services/assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,20 +342,24 @@ def get_assignment_groups(self, assignment) -> Sequence[Grouping]:
"""Get the relevant groups for the assignment from the DB."""
if group_set_id := assignment.extra.get("group_set_id"):
return self._db.scalars(
select(Grouping).where(
select(Grouping)
.where(
Grouping.parent_id == assignment.course_id,
Grouping.extra["group_set_id"].astext == str(group_set_id),
)
.order_by(Grouping.lms_name.asc())
).all()
return []

def get_assignment_sections(self, assignment) -> Sequence[Grouping]:
"""Get the relevant groups for the assignment from the DB."""
return self._db.scalars(
select(Grouping).where(
select(Grouping)
.where(
Grouping.parent_id == assignment.course_id,
Grouping.type == "canvas_section",
)
.order_by(Grouping.lms_name.asc())
).all()

def _update_auto_grading_config(
Expand Down

0 comments on commit 58c5967

Please sign in to comment.