Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: block events for missing courses #355

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't remember, will this be caught upstream so it doesn't break bulk export?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only helper that raises an exception is get_anonymous_user_id and it raises a ValueError exception. It shouldn't break the workflow.

@ziafazal Am I right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ian2012 yes ValueError is caught here so it should not break.



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")