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: updates based on changes to EnrollmentService #7

Merged
merged 2 commits into from
Mar 27, 2024
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: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ['3.8']
os: [ubuntu-20.04, ubuntu-latest]
python-version: ['3.8', '3.12']
toxenv: [quality, django32, django40]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
8 changes: 4 additions & 4 deletions openedx_cmi5_xblock/openedx_cmi5_xblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import xml.etree.ElementTree as ET
import zipfile

import pkg_resources
import importlib_resources
import requests
from django.conf import settings
from django.core.files.base import ContentFile
Expand Down Expand Up @@ -361,12 +361,12 @@ def get_grade(self):

def get_erollment_id(self):
"""Retrieves the enrollment ID of the current user for the XBlock's course."""
django_user = self.runtime.service(self, 'user').get_current_django_user()
django_user_id = self.get_current_user_attr('edx-platform.user_id')
course_id = self.scope_ids.usage_id.context_key

try:
enrollment = self.runtime.service(self, 'enrollments').get_active_enrollments_by_course_and_user(
course_id, django_user
course_id, django_user_id
)
return enrollment.id
except Exception as err:
Expand Down Expand Up @@ -648,7 +648,7 @@ def workbench_scenarios():

def resource_string(path):
"""Handy helper for getting resources from our kit."""
data = pkg_resources.resource_string(__name__, path)
data = importlib_resources.files(__name__).joinpath(path).read_bytes()
return data.decode('utf8')


Expand Down
4 changes: 2 additions & 2 deletions openedx_cmi5_xblock/static/html/studio.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<span class="tip setting-help">{% trans field_weight.help %}</span>
</li>

<li class="field comp-setting-entry is-set">
<!-- <li class="field comp-setting-entry is-set">
<div class="wrapper-comp-setting">
<label class="label setting-label" for="width">{% trans field_width.display_name %}</label>
<input
Expand All @@ -92,7 +92,7 @@
/>
</div>
<span class="tip setting-help">{% trans field_height.help %}</span>
</li>
</li> -->
</ul>

<div class="xblock-actions">
Expand Down