Skip to content

Commit

Permalink
Merge branch 'jill/nelc/and/add_tracking_logs' into jill/nelc/and/add…
Browse files Browse the repository at this point in the history
…_completion_events
  • Loading branch information
pomegranited committed Jun 13, 2024
2 parents 7652429 + 381dbd7 commit bb2f8e6
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Change Log
Unreleased
~~~~~~~~~~

[4.0.4] - 2024-06-13
~~~~~~~~~~~~~~~~~~~~

* Emit tracking log events for `openedx.completion_aggregator.progress.*` and
`openedx.completion_aggregator.completion.*` for the various block/course types

[4.0.3] - 2023-10-24
~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion completion_aggregator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

from __future__ import absolute_import, unicode_literals

__version__ = '4.0.3'
__version__ = '4.0.4'
2 changes: 1 addition & 1 deletion test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def root(*args):
AUTH_USER_MODEL = 'auth.User'
CELERY_ALWAYS_EAGER = True
COMPLETION_AGGREGATOR_BLOCK_TYPES = {'course', 'chapter', 'sequential'}
COMPLETION_AGGREGATOR_ASYNC_AGGREGATION = True
COMPLETION_AGGREGATOR_ASYNC_AGGREGATION = False
COMPLETION_AGGREGATOR_AGGREGATION_LOCK = 'COMPLETION_AGGREGATOR_AGGREGATION_LOCK'
COMPLETION_AGGREGATOR_CLEANUP_LOCK = 'COMPLETION_AGGREGATOR_CLEANUP_LOCK'
COMPLETION_AGGREGATOR_AGGREGATION_LOCK_TIMEOUT_SECONDS = 1800
Expand Down
3 changes: 3 additions & 0 deletions tests/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def test_synchronous_aggregation(mock_task, users):
assert mock_task.call_count == 4 # Called once per created BlockCompletion


@override_settings(COMPLETION_AGGREGATOR_ASYNC_AGGREGATION=True)
@patch('completion_aggregator.tasks.aggregation_tasks.update_aggregators.apply_async')
def test_with_multiple_batches(mock_task, users):
course_key = CourseKey.from_string('course-v1:OpenCraft+Onboarding+2018')
Expand Down Expand Up @@ -87,6 +88,7 @@ def test_with_multiple_batches(mock_task, users):
}


@override_settings(COMPLETION_AGGREGATOR_ASYNC_AGGREGATION=True)
@patch('completion_aggregator.tasks.aggregation_tasks.update_aggregators.apply_async')
def test_with_stale_completions(mock_task, users):
course_key = CourseKey.from_string('course-v1:OpenCraft+Onboarding+2018')
Expand All @@ -107,6 +109,7 @@ def test_with_stale_completions(mock_task, users):
assert mock_task.call_count == 2 # Called once for each user


@override_settings(COMPLETION_AGGREGATOR_ASYNC_AGGREGATION=True)
@patch('completion_aggregator.tasks.aggregation_tasks.update_aggregators.apply_async')
def test_with_full_course_stale_completion(mock_task, users):
course_key = CourseKey.from_string('course-v1:OpenCraft+Onboarding+2018')
Expand Down
5 changes: 4 additions & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from xblock.core import XBlock

from django.contrib.auth import get_user_model
from django.test import TestCase
from django.test import TestCase, override_settings
from django.utils.timezone import now

from completion.models import BlockCompletion
Expand Down Expand Up @@ -282,6 +282,7 @@ def test_unmodified_course(self):
]
)

@override_settings(COMPLETION_AGGREGATOR_ASYNC_AGGREGATION=True)
@XBlock.register_temp_plugin(CourseBlock, 'course')
@XBlock.register_temp_plugin(OtherAggBlock, 'chapter')
@XBlock.register_temp_plugin(HTMLBlock, 'html')
Expand Down Expand Up @@ -319,6 +320,7 @@ def test_modified_course(self):
]
)

@override_settings(COMPLETION_AGGREGATOR_ASYNC_AGGREGATION=True)
@XBlock.register_temp_plugin(CourseBlock, 'course')
@XBlock.register_temp_plugin(OtherAggBlock, 'chapter')
@XBlock.register_temp_plugin(HTMLBlock, 'html')
Expand Down Expand Up @@ -356,6 +358,7 @@ def test_pass_changed_blocks_argument(self):
]
)

@override_settings(COMPLETION_AGGREGATOR_ASYNC_AGGREGATION=True)
@XBlock.register_temp_plugin(CourseBlock, 'course')
@XBlock.register_temp_plugin(OtherAggBlock, 'chapter')
@XBlock.register_temp_plugin(HTMLBlock, 'html')
Expand Down
2 changes: 2 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from django.utils.timezone import now

from completion_aggregator.models import Aggregator
from completion_aggregator.settings import common as common_settings


@ddt.ddt
Expand All @@ -35,6 +36,7 @@ def setUp(self):
self.user = get_user_model().objects.create(username='testuser')
self.tracker_patch = patch('completion_aggregator.models.tracker')
self.tracker_mock = self.tracker_patch.start()
common_settings.plugin_settings(settings)

def tearDown(self):
"""Stop patching."""
Expand Down
3 changes: 2 additions & 1 deletion tests/test_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from opaque_keys.edx.keys import CourseKey, UsageKey

from django.contrib.auth import get_user_model
from django.test import TestCase
from django.test import TestCase, override_settings
from django.utils.timezone import now

from completion.models import BlockCompletion
Expand All @@ -35,6 +35,7 @@ def setUp(self):
user_model.objects.get_or_create(username='user2')[0],
]

@override_settings(COMPLETION_AGGREGATOR_ASYNC_AGGREGATION=True)
@patch('completion_aggregator.tasks.aggregation_tasks.update_aggregators.apply_async')
def test_basic(self, mock_task):
course_key = CourseKey.from_string('edX/test/2018')
Expand Down

0 comments on commit bb2f8e6

Please sign in to comment.