Skip to content

Commit

Permalink
fix: data layer quality fixes (#2024)
Browse files Browse the repository at this point in the history
* fix: add missing __init__.py

* fix: pylint quality issues

* chore: bump ORA to version 5.2.3
  • Loading branch information
nsprenkle authored Aug 9, 2023
1 parent 0faef57 commit b5760a8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion openassessment/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
Initialization Information for Open Assessment Module
"""
__version__ = '5.2.2'
__version__ = '5.2.3'
Empty file.
21 changes: 16 additions & 5 deletions openassessment/xblock/data_layer/serializers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
"""
Serializers for ORA's BFF.
These are the response shapes that power the MFE implementation of the ORA UI.
"""
# pylint: disable=abstract-method

from rest_framework.serializers import (
BooleanField,
DateTimeField,
Expand Down Expand Up @@ -56,6 +63,7 @@ class TeamsConfigSerializer(Serializer):
def get_teamsetName(self, block):
if block.teamset_config is not None:
return block.teamset_config.name
return None


class SubmissionConfigSerializer(Serializer):
Expand Down Expand Up @@ -129,7 +137,7 @@ class PeerSettingsSerializer(Serializer):
class AssessmentStepSettingsSerializer(Serializer):
"""
Generic Assessments step, where we just need to know if the step is
required given the ora.rubric_assessments soruce.
required given the ora.rubric_assessments source.
"""

required = BooleanField(default=True)
Expand All @@ -143,10 +151,10 @@ def _get_step(self, rubric_assessments, step_name):

def __init__(self, *args, **kwargs):
self.step_name = kwargs.pop("step_name")
return super().__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

def to_representation(self, rubric_assessments):
assessment_step = self._get_step(rubric_assessments, self.step_name)
def to_representation(self, instance):
assessment_step = self._get_step(instance, self.step_name)

# Special handling for the peer step which includes extra fields
if assessment_step and self.step_name == "peer-assessment":
Expand Down Expand Up @@ -208,7 +216,10 @@ class OraBlockInfoSerializer(Serializer):
leaderboardConfig = LeaderboardConfigSerializer(source="*")

def get_baseAssetUrl(self, block):
return block._get_base_url_path_for_course_assets(block.course.id)
# pylint: disable=protected-access
return block._get_base_url_path_for_course_assets(
block.course.id
)

def get_prompts(self, block):
return [prompt["description"] for prompt in block.prompts]
6 changes: 1 addition & 5 deletions openassessment/xblock/data_layer/test_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
SubmissionConfigSerializer,
)
from openassessment.xblock.test.base import XBlockHandlerTestCase, scenario
from openassessment.xblock.test.test_team import (
MockTeamsConfigurationService,
MockTeamsService,
)


class TestSubmissionConfigSerializer(XBlockHandlerTestCase):
Expand Down Expand Up @@ -275,7 +271,7 @@ def test_order(self, xblock):

# Then I get the right ordering and step keys
self.assertListEqual(steps_config["order"], expected_order)
steps = {step for step in steps_config["settings"].keys()}
steps = set(steps_config["settings"].keys())
self.assertSetEqual(steps, expected_step_keys)


Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "edx-ora2",
"version": "5.2.2",
"version": "5.2.3",
"repository": "https://github.com/openedx/edx-ora2.git",
"dependencies": {
"@edx/frontend-build": "^6.1.1",
Expand Down

0 comments on commit b5760a8

Please sign in to comment.