Skip to content

Commit

Permalink
fix: remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
jansenk authored and nsprenkle committed Nov 6, 2023
1 parent 6f8f5c1 commit fae1c97
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 100 deletions.
11 changes: 2 additions & 9 deletions openassessment/xblock/ui_mixins/mfe/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,9 @@ def get_learner_data(self, data, suffix=""): # pylint: disable=unused-argument
raise JsonHandlerError(400, f"Cannot jump to step: {jump_step}")

# Determine which mode we are viewing in, since data comes from different sources
# View submission, submitted or draft
if workflow_step == "submission" or jump_step == "submission":

# View our submitted response
if self.submission_data.has_submitted:
serializer_context.update({"view": "submission"})

# View our draft response
else:
serializer_context.update({"view": "draft"})

serializer_context.update({"view": "submission"})
# View the current assessment step
else:
serializer_context.update({"view": "assessment"})
Expand Down
42 changes: 0 additions & 42 deletions openassessment/xblock/ui_mixins/mfe/page_context_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,43 +34,6 @@ class AssessmentScoreSerializer(Serializer):
possible = IntegerField(source="points_possible", required=False)


class ReceivedGradesSerializer(Serializer):
"""
Received grades for each of the applicable graded steps
Returns:
{
self: (Assessment score object)
peer: (Assessment score object)
staff: (Assessment score object)
}
"""

self = AssessmentScoreSerializer(source="grades.self_score")
peer = AssessmentScoreSerializer(source="grades.peer_score")
staff = AssessmentScoreSerializer(source="grades.staff_score")

def to_representation(self, instance):
"""
Hook output to remove steps that are not part of the assignment.
Grades are not released for steps until all steps are completed.
"""
step_names = ["self", "peer", "staff"]

# NOTE - cache this so we don't update the workflow
configured_steps = instance.status_details.keys()
is_done = instance.is_done

for step in step_names:
if step not in configured_steps:
self.fields.pop(step)

if not is_done:
return {field: {} for field in self.fields}

return super().to_representation(instance)


class ClosedInfoSerializer(Serializer):
"""Serialize closed info from a given assessment step API"""

Expand Down Expand Up @@ -273,16 +236,11 @@ class ProgressSerializer(Serializer):
{
// What step are we on? An index to the configuration from ORA config call.
activeStepName: (String) one of ["submission", "studentTraining", "peer", "self", "staff", "done]
hasReceivedFinalGrade: (Bool) // In effect, is the ORA complete?
receivedGrades: (Object) Staff grade data, when there is a completed staff grade.
activeStepInfo: (Object) Specific info for the active step
}
"""

activeStepName = SerializerMethodField()
hasReceivedFinalGrade = BooleanField(source="workflow_data.is_done")
receivedGrades = ReceivedGradesSerializer(source="workflow_data")
stepInfo = StepInfoSerializer(source="*")

def get_activeStepName(self, instance):
Expand Down
2 changes: 1 addition & 1 deletion openassessment/xblock/ui_mixins/mfe/test_mfe_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def test_start_submission(self, xblock, mock_serializer):
# Then I get submission
expected_context = {
"step": "submission",
"view": "draft",
"view": "submission",
}
mock_serializer.assert_called_once_with(xblock, context={**expected_context})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,6 @@ def test_submission(self, xblock):
# Then I get the expected shapes
expected_data = {
"activeStepName": "submission",
"hasReceivedFinalGrade": False,
"receivedGrades": {},
"stepInfo": {
"submission": {
"closed": False,
Expand Down Expand Up @@ -335,11 +333,6 @@ def test_student_training(self, xblock):
# Then I get the expected shapes
expected_data = {
"activeStepName": "studentTraining",
"hasReceivedFinalGrade": False,
"receivedGrades": {
"peer": {},
"staff": {},
},
"stepInfo": {
"submission": {
"closed": False,
Expand Down Expand Up @@ -380,11 +373,6 @@ def test_student_training_due(self, xblock):
# Then I get the expected shapes
expected_data = {
"activeStepName": "studentTraining",
"hasReceivedFinalGrade": False,
"receivedGrades": {
"peer": {},
"staff": {},
},
"stepInfo": {
"submission": {
"closed": True,
Expand Down Expand Up @@ -425,11 +413,6 @@ def test_student_training_not_yet_available(self, xblock):
# Then I get the expected shapes
expected_data = {
"activeStepName": "studentTraining",
"hasReceivedFinalGrade": False,
"receivedGrades": {
"peer": {},
"staff": {},
},
"stepInfo": {
"submission": {
"closed": False,
Expand Down Expand Up @@ -470,11 +453,6 @@ def test_peer_assessment(self, xblock):
# Then I get the expected shapes
expected_data = {
"activeStepName": "peer",
"hasReceivedFinalGrade": False,
"receivedGrades": {
"peer": {},
"staff": {},
},
"stepInfo": {
"submission": {
"closed": False,
Expand Down Expand Up @@ -517,11 +495,6 @@ def test_peer_assessment__cancelled(self, xblock):
# Then I get the expected shapes
expected_data = {
"activeStepName": "submission",
"hasReceivedFinalGrade": False,
"receivedGrades": {
"peer": {},
"staff": {},
},
"stepInfo": {
"submission": {
"closed": False,
Expand Down Expand Up @@ -550,11 +523,6 @@ def test_self_assessment(self, xblock):
# Then I get the expected shapes
expected_data = {
"activeStepName": "self",
"hasReceivedFinalGrade": False,
"receivedGrades": {
"self": {},
"staff": {},
},
"stepInfo": {
"submission": {
"closed": False,
Expand Down Expand Up @@ -586,12 +554,6 @@ def test_self_assessment_closed(self, xblock):
# Then I get the expected shapes
expected_data = {
"activeStepName": "self",
"hasReceivedFinalGrade": False,
"receivedGrades": {
"self": {},
"peer": {},
"staff": {},
},
"stepInfo": {
"submission": {
"closed": True,
Expand Down Expand Up @@ -624,12 +586,6 @@ def test_self_assessment_not_available(self, xblock):
# Then I get the expected shapes
expected_data = {
"activeStepName": "self",
"hasReceivedFinalGrade": False,
"receivedGrades": {
"self": {},
"peer": {},
"staff": {},
},
"stepInfo": {
"submission": {
"closed": False,
Expand Down Expand Up @@ -673,10 +629,6 @@ def test_team_assignment(self, xblock):
# Then I get the expected shapes
expected_data = {

Check warning on line 630 in openassessment/xblock/ui_mixins/mfe/test_page_context_serializer.py

View check run for this annotation

Codecov / codecov/patch

openassessment/xblock/ui_mixins/mfe/test_page_context_serializer.py#L630

Added line #L630 was not covered by tests
"activeStepName": "staff",
"hasReceivedFinalGrade": False,
"receivedGrades": {
# NOTE - Teams actually have a different step type that should go here
},
"stepInfo": {
"submission": {
"closed": False,
Expand Down

0 comments on commit fae1c97

Please sign in to comment.