Skip to content

Commit

Permalink
fix: block events for missing courses
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Oct 3, 2023
1 parent 99ede4e commit e48b7c0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ Change Log
Unreleased
~~~~~~~~~~
[7.0.1]

* Do not send events for unknown courses

[7.0.0]

* Multi-question problem_check tracking log statements will now be split into one xAPI statement for each question

[6.2.0]

* Add support for completion events
Expand Down
2 changes: 1 addition & 1 deletion event_routing_backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Various backends for receiving edX LMS events..
"""

__version__ = '7.0.0'
__version__ = '7.0.1'
4 changes: 1 addition & 3 deletions event_routing_backends/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,7 @@ def get_course_from_id(course_id):
course_overviews = get_course_overviews([course_key])
if course_overviews:
return course_overviews[0]
return {
"display_name": "Unknown Course",
}
raise ValueError(f"Course with id {course_id} does not exist.")


def convert_seconds_to_iso(seconds):
Expand Down
6 changes: 3 additions & 3 deletions event_routing_backends/tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_get_uuid5(self):
self.assertNotEqual(uuid_1, uuid_3)

@patch('event_routing_backends.helpers.get_course_overviews')
def test_get_course_from_id(self, mock_get_course_overviews):
def test_get_course_from_id_unknown_course(self, mock_get_course_overviews):
mock_get_course_overviews.return_value = []
course = get_course_from_id("foo")
self.assertEqual(course["display_name"], "Unknown Course")
with self.assertRaises(ValueError):
get_course_from_id("foo")

0 comments on commit e48b7c0

Please sign in to comment.