Skip to content

Commit

Permalink
AssignmentsGradesService refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-viskov committed Sep 10, 2022
1 parent 862a915 commit f8e8804
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions pylti1p3/assignments_grades.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ def can_read_grades(self):
def can_put_grade(self):
return "https://purl.imsglobal.org/spec/lti-ags/scope/score" in self._service_data['scope']

def put_grade(self, grade, lineitem=None, create_default_lineitem=True,
default_lineitem_tag='default'):
# type: (Grade, t.Optional[LineItem], bool, str) -> _ServiceConnectorResponse
def put_grade(self, grade, lineitem=None):
# type: (Grade, t.Optional[LineItem]) -> _ServiceConnectorResponse
"""
Send grade to the LTI platform.
Expand All @@ -62,15 +61,7 @@ def put_grade(self, grade, lineitem=None, create_default_lineitem=True,
elif not lineitem and self._service_data.get('lineitem'):
score_url = self._service_data.get('lineitem')
else:
if not create_default_lineitem:
raise LtiException("Can't find lineitem to put grade")
if not lineitem:
lineitem = LineItem()
lineitem.set_label('default') \
.set_tag(default_lineitem_tag)\
.set_score_maximum(100)
lineitem = self.find_or_create_lineitem(lineitem)
score_url = lineitem.get_id()

This comment has been minimized.

Copy link
@hmoffatt

hmoffatt Sep 13, 2022

Contributor

This no longer handles the case where lineitem is set and already has an id.

raise LtiException("Can't find lineitem to put grade")

assert score_url is not None
score_url = self._add_url_path_ending(score_url, 'scores')
Expand Down

0 comments on commit f8e8804

Please sign in to comment.