-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: add canvas integration plugin #8
Conversation
95617a6
to
649d64f
Compare
300bc95
to
d76d51d
Compare
123176d
to
ffa1c41
Compare
return results | ||
|
||
|
||
def get_subsection_user_grades(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.
@arslanashraf7 I think we can remove a lot of code around getting user's grate by assignment and use builtin- method of PersistentGrades
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.
As discussed keeping the scope of this in mind, I've created a ticket to keep track of this optimization #10.
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.
@arslanashraf7 few improvements I suggested which are not necessarily needed to be done right now but would be useful in future.
""" | ||
session = requests.Session() | ||
session.headers.update({ | ||
"Authorization": "Bearer {token}".format(token=settings.CANVAS_ACCESS_TOKEN) |
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.
I think we can persist canvas credentials in encrypted field of django model instead of using them from settings
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.
@arslanashraf7 can you check with @mitodl/devops for their preference for managing the secrets?
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.
Sure, Currently we are injecting them from the vault https://github.com/search?q=org%3Amitodl+CANVAS_ACCESS_TOKEN&type=code. I'll talk to the ops guys if they want to go with this approach or the existing vault approach is better.
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.
It's fine to keep it as a settings attribute because we can take the same approach of managing the value through the configuration template.
"name": subsection_block.display_name, | ||
"integration_id": str(subsection_block.location), | ||
"grading_type": "percent", | ||
"points_possible": DEFAULT_ASSIGNMENT_POINTS, |
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.
possible grade of actual subsection instead of default value.
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.
This would be done as part of #10 since it will be easier to directly get the max weightage/score for a subsection.
"""Settings for the canvas integration plugin.""" | ||
settings.CANVAS_ACCESS_TOKEN = None | ||
settings.CANVAS_BASE_URL = None | ||
settings.FEATURES['ENABLE_CANVAS_INTEGRATION'] = False |
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.
By default this feature should be enabled.
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.
I agree with the default, but do we even need a feature flag? If the plugin is installed, shouldn't that be a clear signal that it should be turned on?
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.
@pdpinch , We've been running the canvas behind a feature flag from when we first implemented that & I'm not sure what was the reason to keep it behind a flag but we can remove it and assume if the plugin is installed, the canvas is enabled.
The flag is used only once in the edx counterpart and we can make that check settings.INSTALLED_APPS
instead of a flag. I'll remove the feature flag now unless you say otherwise.
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.
I think it would be better to test on INSTALLED_APPS, but if you want to leave that for another issue & PR, I would be OK with that.
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.
I felt it would be better to do this in current PR and make it available at the earliest stage possible of the plugin, Updated.
@ziafazal I've addressed feedback and responded to some comments. This is ready for review again, Could you please take a look. In addition, I've also addressed a bug regarding grades/assignments update counts that were 0 in all the cases. This might have been a regression of mitodl/edx-platform#189. |
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.
👍
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.
👍
This PR has been sitting for a while since it has taken so long for me to address other issues, get pants
to actually build the plugin, and get the plugin itself working in devstack. It seems that my Canvas token is outdated, so I didn't directly test the functionality, but I finally managed to get the Canvas tab to show up and work correctly. Given the timing I think it's best to merge this as it is, and if there are any lingering bugs, those can be addressed in future PRs. I have a couple concerns though:
- The instructions on this PR are not complete. I had to dig around past issues/PRs to figure out that I needed to add a
canvas_course_id
setting to my course, which I ended up doing in Studio. That leads me to the next concern... - Why is the documentation not included in this PR? Why would we add it in a future PR? This is the PR that adds the feature, so why not merge it with instructions to use the feature?
Anyway, feel free to merge this as it is and please keep those notes in mind for future PRs
@gsidebo I'm sorry I somehow missed some details in the PR description but thanks for reviewing this PR anyway. I agree with your idea of adding the documentation along with the feature which should be followed in the oncoming PRs. |
Related Tickets:
#4
What's this PR does?
canvas_integration
app fromedx-platform
into a separate pluginHow to test?
To test this PR you will need a counterpart in the
edx-platform
and that part is specifically done in mitodl/edx-platform#274./pants package ::
and then install that into the edx-platform)make lms-restart
)(More instruction to be added once the PR is finalized)
Instructor
tab and make sure you see aCanvas
tab under itBackground context:
We had made several changes inside our for of the edx-platform where we added a Django application to support canvas integration. In the process, we made many changes in open edX's
Instructor
django application since we wanted to runcanvas_integration
inside theInstrutor
tab. (More details to come)Screenshots:
Landing page and tasks details
List Canvas Enrollments
List Canvas Assignments