-
Notifications
You must be signed in to change notification settings - Fork 0
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
PADV-1201: Filter courses in DeepLinkingForm #36
Conversation
Returns: | ||
List of tuples with choices for the `content_items` field. | ||
|
||
""" | ||
return [ | ||
self.get_content_items_choice(course, request) | ||
for course in course_context().objects.all() | ||
self.get_content_items_choice(course) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kuipumu Same question of the last PR review, Is it necessary that the return of the function be a list? I mention it because of the performance where for example, searching through 100,000 items takes 49.663 seconds with a list, but only 0.007 seconds with a set, taking into account that there are no repeated values in this array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anfbermudezme I didn't tried with a set since the Django documentation specifies the choices field to be a list of tuples, however it works with a set so I change this.
validate_deep_linking_message(message) | ||
|
||
# Redirect to DeepLinkingForm view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kuipumu Add blank line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anfbermudezme I don't think is necessary to add a blank line
|
||
# Get identity claims from launch data. | ||
iss, aud, _sub, _pii = get_identity_claims(message.get_launch_data()) | ||
# Render form template. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kuipumu Add blank line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anfbermudezme I don't think is necessary to add a blank line
@@ -99,8 +99,12 @@ def post( | |||
_('Message type is not LtiResourceLinkRequest.'), | |||
) | |||
# Get launch data. | |||
# TODO: Replace redundant get_launch_data method with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kuipumu There are already tickets for these TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anfbermudezme Just created PADV-1338 so there is also a reference on the backlog for these TODOs.
openedx_lti_tool_plugin/utils.py
Outdated
launch_data: Launch data dictionary. | ||
|
||
Returns: | ||
A tuple containing the `iss`, `aud`, `sub` and PII claims. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kuipumu Add the reference of PII in the docstring please.
Ticket
https://agile-jira.pearson.com/browse/PADV-1201
Description
This PR adds a filter to the courses available on the DeepLinkingForm. This PR adds a DeepLinkingForm method that either returns all CourseContext objects with all courses on the LMS or a filtered CourseContext queryset with only the courses available per LtiTool using the CourseAccesConfiguration allowed_course_ids field.
Type of Change
get_course_contexts
method to DeepLinkingForm Django form.get_content_items_choices
method in the DeepLinkingForm Django form.Testing:
make dev.up.lms
.openedx_lti_tool_plugin
on the LMS.ngrok http 18000
openedx_lti_tool_plugin.course_access_configuration
.