-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ACADEMIC-16210: Several updates based on PR comments
- Loading branch information
Showing
10 changed files
with
173 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
""" | ||
Implements an API for updating unit and course settings. | ||
""" | ||
from ai_aside.models import AIAsideCourseEnabled, AIAsideUnitEnabled | ||
|
||
|
||
class NotFoundError(Exception): | ||
"Raised when the course/unit is not found in the database" | ||
|
||
|
||
def _get_course(course_key): | ||
"Private method that gets a course based on an id" | ||
try: | ||
record = AIAsideCourseEnabled.objects.get( | ||
course_key=course_key, | ||
) | ||
except AIAsideCourseEnabled.DoesNotExist as exc: | ||
raise NotFoundError from exc | ||
|
||
return record | ||
|
||
|
||
def _get_unit(course_key, unit_key): | ||
"Private method that gets a unit based on an id" | ||
try: | ||
record = AIAsideUnitEnabled.objects.get( | ||
course_key=course_key, | ||
unit_key=unit_key, | ||
) | ||
except AIAsideUnitEnabled.DoesNotExist as exc: | ||
raise NotFoundError from exc | ||
|
||
return record |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# | ||
# This file is autogenerated by pip-compile with Python 3.8 | ||
# by the following command: | ||
# | ||
# pip-compile | ||
# | ||
appdirs==1.4.4 | ||
# via fs | ||
asgiref==3.7.2 | ||
# via django | ||
backports-zoneinfo==0.2.1 | ||
# via django | ||
cffi==1.15.1 | ||
# via pynacl | ||
click==8.1.6 | ||
# via edx-django-utils | ||
django==4.2.3 | ||
# via | ||
# ai-aside (setup.py) | ||
# django-crum | ||
# django-waffle | ||
# djangorestframework | ||
# edx-django-utils | ||
django-crum==0.7.9 | ||
# via edx-django-utils | ||
django-waffle==4.0.0 | ||
# via edx-django-utils | ||
djangorestframework==3.14.0 | ||
# via ai-aside (setup.py) | ||
edx-django-utils==5.6.0 | ||
# via ai-aside (setup.py) | ||
edx-opaque-keys==2.3.0 | ||
# via ai-aside (setup.py) | ||
fs==2.4.16 | ||
# via xblock | ||
lxml==4.9.3 | ||
# via xblock | ||
markupsafe==2.1.3 | ||
# via xblock | ||
newrelic==8.9.0 | ||
# via edx-django-utils | ||
pbr==5.11.1 | ||
# via stevedore | ||
psutil==5.9.5 | ||
# via edx-django-utils | ||
pycparser==2.21 | ||
# via cffi | ||
pymongo==3.13.0 | ||
# via edx-opaque-keys | ||
pynacl==1.5.0 | ||
# via edx-django-utils | ||
python-dateutil==2.8.2 | ||
# via xblock | ||
pytz==2023.3 | ||
# via | ||
# djangorestframework | ||
# xblock | ||
pyyaml==6.0.1 | ||
# via xblock | ||
six==1.16.0 | ||
# via | ||
# fs | ||
# python-dateutil | ||
sqlparse==0.4.4 | ||
# via django | ||
stevedore==5.1.0 | ||
# via | ||
# edx-django-utils | ||
# edx-opaque-keys | ||
typing-extensions==4.7.1 | ||
# via asgiref | ||
web-fragments==2.0.0 | ||
# via xblock | ||
webob==1.8.7 | ||
# via xblock | ||
xblock==1.6.2 | ||
# via ai-aside (setup.py) | ||
|
||
# The following packages are considered to be unsafe in a requirements file: | ||
# setuptools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.