Skip to content

Commit

Permalink
Merge pull request #138 from edx/varshamenon4/fix-course-mode-concat-…
Browse files Browse the repository at this point in the history
…issue

fix: course mode list concatenation issue
  • Loading branch information
varshamenon4 authored Nov 25, 2024
2 parents dcf45e2 + 92bece4 commit 6c590dc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ Change Log
Unreleased
**********

4.4.7 - 2024-11-25
******************
* Fixes the Course Chat View CourseMode concatenation issue

4.4.6 - 2024-11-22
******************
* Gates the chat history endpoint behind a waffle flag
* Add LearningAssistantAuditTrial model

4.4.5 - 2024-11-12
******************
Expand Down
2 changes: 1 addition & 1 deletion learning_assistant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
Plugin for a learning assistant backend, intended for use within edx-platform.
"""

__version__ = '4.4.6'
__version__ = '4.4.7'

default_app_config = 'learning_assistant.apps.LearningAssistantConfig' # pylint: disable=invalid-name
3 changes: 2 additions & 1 deletion learning_assistant/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def post(self, request, course_run_id):
if (
# Here we include CREDIT_MODE and NO_ID_PROFESSIONAL_MODE, as CourseMode.VERIFIED_MODES on its own
# doesn't match what we count as "verified modes" in the frontend component.
enrollment_mode in CourseMode.VERIFIED_MODES + CourseMode.CREDIT_MODE + CourseMode.NO_ID_PROFESSIONAL_MODE
enrollment_mode in CourseMode.VERIFIED_MODES + CourseMode.CREDIT_MODES
+ [CourseMode.NO_ID_PROFESSIONAL_MODE]
or user_role_is_staff(user_role)
):
return self._get_next_message(request, courserun_key, course_run_id)
Expand Down
12 changes: 6 additions & 6 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ def test_audit_trial_expired(self, mock_mode, mock_enrollment,
mock_waffle.return_value = True
mock_role.return_value = 'student'
mock_mode.VERIFIED_MODES = ['verified']
mock_mode.CREDIT_MODE = ['credit']
mock_mode.NO_ID_PROFESSIONAL_MODE = ['no-id']
mock_mode.CREDIT_MODES = ['credit']
mock_mode.NO_ID_PROFESSIONAL_MODE = 'no-id'
mock_mode.UPSELL_TO_VERIFIED_MODES = ['audit']
mock_mode.objects.get.return_value = MagicMock()
mock_mode.expiration_datetime.return_value = datetime.now() - timedelta(days=1)
Expand All @@ -165,8 +165,8 @@ def test_invalid_enrollment_mode(self, mock_mode, mock_enrollment, mock_role, mo
mock_waffle.return_value = True
mock_role.return_value = 'student'
mock_mode.VERIFIED_MODES = ['verified']
mock_mode.CREDIT_MODE = ['credit']
mock_mode.NO_ID_PROFESSIONAL_MODE = ['no-id']
mock_mode.CREDIT_MODES = ['credit']
mock_mode.NO_ID_PROFESSIONAL_MODE = 'no-id'
mock_mode.UPSELL_TO_VERIFIED_MODES = ['audit']
mock_mode.objects.get.return_value = MagicMock()
mock_mode.expiration_datetime.return_value = datetime.now() - timedelta(days=1)
Expand Down Expand Up @@ -206,8 +206,8 @@ def test_chat_response_default(
mock_waffle.return_value = True
mock_role.return_value = 'student'
mock_mode.VERIFIED_MODES = ['verified']
mock_mode.CREDIT_MODE = ['credit']
mock_mode.NO_ID_PROFESSIONAL_MODE = ['no-id']
mock_mode.CREDIT_MODES = ['credit']
mock_mode.NO_ID_PROFESSIONAL_MODE = 'no-id'
mock_mode.UPSELL_TO_VERIFIED_MODES = ['audit']
mock_enrollment.return_value = MagicMock(mode=enrollment_mode)
mock_chat_response.return_value = (200, {'role': 'assistant', 'content': 'Something else'})
Expand Down

0 comments on commit 6c590dc

Please sign in to comment.