Skip to content

Commit

Permalink
Expose auto grading config on the assigment API
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospri committed Sep 5, 2024
1 parent f5a8a95 commit c50466e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lms/views/dashboard/api/assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
APIAssignment,
APIAssignments,
APICourse,
AutoGradingConfig,
)
from lms.models import Assignment, RoleScope, RoleType
from lms.security import Permissions
Expand Down Expand Up @@ -98,7 +99,7 @@ def assignments(self) -> APIAssignments:
)
def assignment(self) -> APIAssignment:
assignment = self.dashboard_service.get_request_assignment(self.request)
return APIAssignment(
api_assignment = APIAssignment(
id=assignment.id,
title=assignment.title,
created=assignment.created.isoformat(),
Expand All @@ -108,6 +109,16 @@ def assignment(self) -> APIAssignment:
),
)

if auto_grading_config := assignment.auto_grading_config:
api_assignment["auto_grading_config"] = AutoGradingConfig(
grading_type=auto_grading_config.grading_type,
activity_calculation=auto_grading_config.activity_calculation,
required_annotations=auto_grading_config.required_annotations,
required_replies=auto_grading_config.required_replies,
)

return api_assignment

@view_config(
route_name="api.dashboard.course.assignments.metrics",
request_method="GET",
Expand Down

0 comments on commit c50466e

Please sign in to comment.