diff --git a/lms/js_config_types.py b/lms/js_config_types.py index 3572435436..b9795cb55a 100644 --- a/lms/js_config_types.py +++ b/lms/js_config_types.py @@ -96,6 +96,8 @@ class APIAssignment(TypedDict): id: int title: str created: str + is_gradable: bool + course: NotRequired[APICourse] sections: NotRequired[list[APISegment]] diff --git a/lms/views/dashboard/api/assignment.py b/lms/views/dashboard/api/assignment.py index 05d62e1f01..32e3e3f653 100644 --- a/lms/views/dashboard/api/assignment.py +++ b/lms/views/dashboard/api/assignment.py @@ -86,6 +86,7 @@ def assignments(self) -> APIAssignments: id=assignment.id, title=assignment.title, created=assignment.created, + is_gradable=assignment.is_gradable, ) for assignment in assignments ], @@ -106,6 +107,7 @@ def assignment(self) -> APIAssignment: id=assignment.id, title=assignment.title, created=assignment.created, + is_gradable=assignment.is_gradable, course=APICourse( id=assignment.course.id, title=assignment.course.lms_name, @@ -189,6 +191,7 @@ def course_assignments_metrics(self) -> APIAssignments: APIAssignment( id=assignment.id, title=assignment.title, + is_gradable=assignment.is_gradable, created=assignment.created, course=api_course, annotation_metrics=metrics, diff --git a/tests/unit/lms/views/dashboard/api/assignment_test.py b/tests/unit/lms/views/dashboard/api/assignment_test.py index 023a58a644..f95e8b7d95 100644 --- a/tests/unit/lms/views/dashboard/api/assignment_test.py +++ b/tests/unit/lms/views/dashboard/api/assignment_test.py @@ -40,7 +40,12 @@ def test_get_assignments( ) assert response == { "assignments": [ - {"id": a.id, "title": a.title, "created": a.created} + { + "id": a.id, + "title": a.title, + "is_gradable": a.is_gradable, + "created": a.created, + } for a in assignments ], "pagination": sentinel.pagination, @@ -70,6 +75,7 @@ def test_assignment( assert response == { "id": assignment.id, "title": assignment.title, + "is_gradable": assignment.is_gradable, "created": assignment.created, "course": {"id": assignment.course.id, "title": assignment.course.lms_name}, } @@ -98,6 +104,7 @@ def test_assignment_with_auto_grading( "id": assignment.id, "title": assignment.title, "created": assignment.created, + "is_gradable": assignment.is_gradable, "course": {"id": assignment.course.id, "title": assignment.course.lms_name}, "groups": [], "auto_grading_config": { @@ -127,6 +134,7 @@ def test_assignment_with_groups( "id": assignment.id, "title": assignment.title, "created": assignment.created, + "is_gradable": assignment.is_gradable, "course": {"id": assignment.course.id, "title": assignment.course.lms_name}, "groups": [ {"h_authority_provided_id": g.authority_provided_id, "name": g.lms_name} @@ -154,6 +162,7 @@ def test_assignment_with_sections( "id": assignment.id, "title": assignment.title, "created": assignment.created, + "is_gradable": assignment.is_gradable, "course": {"id": assignment.course.id, "title": assignment.course.lms_name}, "sections": [ {"h_authority_provided_id": g.authority_provided_id, "name": g.lms_name} @@ -211,6 +220,7 @@ def test_course_assignments( { "id": assignment.id, "title": assignment.title, + "is_gradable": assignment.is_gradable, "created": assignment.created, "course": { "id": course.id, @@ -225,6 +235,7 @@ def test_course_assignments( { "id": assignment_with_no_annos.id, "title": assignment_with_no_annos.title, + "is_gradable": assignment.is_gradable, "created": assignment_with_no_annos.created, "course": { "id": course.id,