Skip to content

Commit

Permalink
Model for the LMSGroupSet table
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospri committed Nov 5, 2024
1 parent 02ff8ac commit 2135e35
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions lms/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from lms.models.grading_info import GradingInfo
from lms.models.grading_sync import GradingSync, GradingSyncGrade
from lms.models.group_info import GroupInfo
from lms.models.group_set import LMSGroupSet
from lms.models.grouping import (
BlackboardGroup,
CanvasGroup,
Expand Down
36 changes: 36 additions & 0 deletions lms/models/group_set.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from typing import TYPE_CHECKING

from sqlalchemy import ForeignKey, UniqueConstraint
from sqlalchemy.orm import Mapped, mapped_column, relationship

from lms.db import Base
from lms.models._mixins import CreatedUpdatedMixin

if TYPE_CHECKING:
from lms.models import LMSCourse


class LMSGroupSet(CreatedUpdatedMixin, Base):
"""Group sets are different ways to divide a course's roster into groups.
Segments that represent groups belong to one group set.
Some LMS call this concept a "Group category" instead.
"""

__tablename__ = "lms_group_set"

__table_args__ = (UniqueConstraint("lms_course_id", "lms_id"),)

id: Mapped[int] = mapped_column(autoincrement=True, primary_key=True)

lms_id: Mapped[str] = mapped_column(index=True)
"""ID of this group set in the LMS"""

name: Mapped[str] = mapped_column()
"""Name of this group set in the LMS"""

lms_course_id: Mapped[int] = mapped_column(ForeignKey("lms_course.id"))
"""ID of the course this group set belongs to"""

lms_course: Mapped["LMSCourse"] = relationship("LMSCourse")

0 comments on commit 2135e35

Please sign in to comment.