Backport completion-by-viewing logic - #1104
Conversation
4b54f61 to
dd09f8e
Compare
|
@xitij2000 Just a heads up: This is nearly ready for review. I'll have testing instructions up soon. |
|
@xitij2000 Can you please take a look when you get a moment. I have one outstanding issue I'm trying to resolve, but I think it's reviewable in spite of that issue, and I'd rather get feedback sooner than later. |
There was a problem hiding this comment.
This is the location of the hardcoded static path.
|
@xitij2000 I resolved the STATIC_URL issue. |
|
@jcdyer Sorry for not being much help with the static url issue. I'm glad you figured it out! I've been through the code and everything seems fine. Will just test and approve now. |
|
@jcdyer I've tested this using the steps you provided, and while it seems to work fine on a regular page, on the The block is marked as completed though. Is this behaviour expected? Perhaps Other than the above this is a 👍 from me. |
|
@xitij2000 I'll need to look into that. The /xblock/ code is backported from a WIP PR (https://github.com/edx/edx-platform/pull/18273), so it's not yet as thoroughly tested as the other part. I'd rather avoid making extensive changes to the core code if possible, as this is a backport from mainline edx platform, and we don't want to make it more painful than necessary to migrate to Hawthorne in the future. |
|
@jcdyer If it helps, |
|
@xitij2000 It's a big file, but it's used in most pages (because it defines the common code), so it should be cached most of the time. I just came to the same conclusion. It's because we use CommonsChunkLoader in our webpack config. I've added it in, and everything seems to be working without complaints now. |
|
@jcdyer 👍 I'm no longer getting the error! |
Remove need for RequireJS to load completion in verticals.
5896f51 to
8fa9b49
Compare
|
@ihtram FYI. I realized we didn't ping you on these PRs (sorry!), so wanted to make sure you're aware that we're merging the PRs that backport the new completion API, so we can soon move to it and then deprecate+remove |
Brings complete-by-viewing code into edx-solutions fork of edx platform. This enables the completion system to register when a user has seen blocks that are completed by being viewed, including, most notably, html blocks.
JIRA tickets: OC-4520, MCKIN-7751
Discussions:
Dependencies: None
Screenshots:
Sandbox URL: TBD - sandbox is being provisioned.
Merge deadline: None
Testing instructions:
from completion.models import BlockCompletion
BlockCompletion.objects.all().delete()
/xblock/<UsageKey>also marks the block as complete.Author notes and concerns:
It's proving more difficult than I anticipated to import the javascript from the location at STATIC_URL, so I've pulled that out to get a review on the rest of the code. Things I've tried:
os.path.join(settings.STATIC_URL, 'bundles/CompletionOnViewService.js')in vertical_block.py, where the import currently lives. settings.STATIC_URL returns None during tests, probably because code under common does not get tested in a django context. This causes the os.path.join to raise an AttributeError (or some other exception).${static.url('bundles/CompletionOnViewService.js')}in various mako templates, including lms/templates/seq_module.html and lms/templates/vert_module.html. This caused the js file to get downloaded properly, but the required function (markBlockCompletedOnViewIfNeeded) was then not found. I'm not sure if the problem was some kind of namespacing issue, or that the js was loaded too late.This is exactly the kind of dumb issue that should be easy, but always makes JS tickets take longer than I think they should for me. If you have any suggestions, I'd love to hear it. Otherwise, I'll just keep investigating.
Reviewers
Settings
N/A