-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Mark blocks completed on view in render_xblock view. #18273
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
Mark blocks completed on view in render_xblock view. #18273
Conversation
|
Thanks for the pull request, @symbolist! I've created OSPR-2441 to keep track of it in JIRA. JIRA is a place for product owners to prioritize feature reviews by the engineering development teams. Feel free to add as much of the following information to the ticket:
All technical communication about the code itself will still be done via the GitHub pull request interface. As a reminder, our process documentation is here. |
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.
The vertical block is still referencing the completion service, so it still wants completion.
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.
Since we only include this service when enableCompletionOnViewService is set, it's ok to forego this check.
|
Hi @symbolist, thank you for the contribution! Feel free to ping me when this is ready for review and passes all the tests. Thanks! |
ddcc920 to
a151cc7
Compare
|
Hi @mduboseedx! Thanks. Yes, I'll let you know when we have completed the code review on our side. |
|
@pomegranited I have added the Python tests. I could not find tests for the courseware views so I have added those as well. There are a few small issues that need to be resolved. But otherwise you can review this now. |
|
jenkins run python |
|
jenkins run bokchoy |
0da91a4 to
c6f3075
Compare
|
@symbolist I'm getting this JS error when I load the unit in LMS (same in chromeless view): Are you? |
|
@pomegranited Can you pull again? That is due to a wrong attempt at fixing a quality issue that I reverted. https://github.com/edx/edx-platform/pull/18273/files#diff-4a1680b05e9915f0d36cc9fe5f3173b4R26 (Btw you have tagged @UmanShahzad). |
|
Sorry @symbolist , this still isn't working for me 😦 I am seeing the updated code in my browser, so the assets are rebuilding fine, but the I couldn't find another example of a requireJS file on the platform that just exports a function in this way -- maybe if you structure it like the other requirejs files and encapsulate the function in an object/class, it will work? |
|
@pomegranited I suspect it has to do with stale caches. I can toggle it between not-working and working by adding and removing the If the If the If you are seeing the former, can you try doing a |
|
@pomegranited In case it is helpful I have refreshed the sandbox with the latest commits and enabled completion on it: https://pr18273.sandbox.opencraft.hosting/. |
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.
👍 Thanks for your patience, and for setting up the sandbox @symbolist ! Turns out my issue locally was due to docker-sync, and so my devstack wasn't seeing your updated files. Sorry it took me so long to find it!
Just one nit, and tests need to pass, but this is good to go upstream after that.
- I tested this using the PR test instructions, and also tested videos to ensure that they are not sending completion until the last few seconds of the video.
- I read through the code
-
I checked for accessibility issues - Includes documentation
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.
nit: could you remove most of these blank lines? Don't need so much spacing, I think.
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.
👍 for making these tests better 😄
|
jenkins run all |
|
@symbolist It looks like tests are passing. Is this ready for review? |
|
@jcdyer FYI, can you take at least a quick look at this too? |
|
@bradenmacdonald Will do. |
|
@mduboseedx thanks for keeping track! :) We will let you know as soon as this is ready for review from the edX side (though this is part of a series of work and @jcdyer may already have a reviewer in mind). |
|
@jcdyer I have pushed the bokchoy tests to this branch and the tests have passed. |
jcdyer
left a comment
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.
Thanks for this @symbolist. It looks good to me.
|
@staubina @iloveagent57 This is ready for an upstream review. I'm not sure who is planning to take this one. This is to resolve the issue of completions not getting submitted when viewing pages on mobile. |
schenedx
left a comment
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 got a few question in this PR.
Rest looks pretty good to me.
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.
Why using string to specify Boolean values?
If the values here are meant for the javascript, can we use Boolean to string str()?
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 have changed this to a Boolean.
openedx/core/lib/completion.py
Outdated
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.
Should these methods be part of the https://github.com/edx/completion repo?
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.
@jcdyer Should these methods be moved onto the CompletionService? I see there are a couple of similar helper methods on it.
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.
@symbolist The CompletionService looks like it would be a good place for it. 👍
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.
Moved to CompletionService.
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.
Same with this test, shouldn't this test be part of https://github.com/edx/completion?
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.
edx/completion isn't really the right place, since these tests need modulestore stuff. I put all of the integration tests between the completion repo and edx-platform here: https://github.com/open-craft/edx-platform/tree/9a6c4033f383f4e05c3390210853ef60d40d4b6a/openedx/tests/completion_integration
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.
Some tests were moved to the completion package and others to penedx/tests/completion_integration/test_services.py.
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 like the way this lets us put more of the state directly on the completable xblocks without requiring XBlock authors to be explicitly aware of how completion works, while minimizing the specialness of verticals. 👍
iloveagent57
left a comment
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.
Nice work, @symbolist ! This looks pretty good, just a couple of small nits from me (and an echo of comments shared by others about relocating some code and tests). Thanks!
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.
nit: completion_service.get_completion_by_viewing_delay_ms() will return the same thing on each call, so you could just store it in a variable outside your for loop.
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 have updated this.
openedx/core/lib/completion.py
Outdated
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.
Nit: consider renaming this to something like can_block_be_completed_on_view. Just because a block meets the conditions in the body of this function, doesn't mean it should be marked complete yet - we still have to know if it's already been completed (as you check for below).
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.
Renamed to can_block_be_completed_on_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.
edx/completion isn't really the right place, since these tests need modulestore stuff. I put all of the integration tests between the completion repo and edx-platform here: https://github.com/open-craft/edx-platform/tree/9a6c4033f383f4e05c3390210853ef60d40d4b6a/openedx/tests/completion_integration
9a6c403 to
532ac86
Compare
|
The test failures seem to be because putting the git url for the completion repo did not work correctly. It would just be simpler to wait till the completion package update is released and then update this in one go. |
|
Just checking in on this PR, I think @iloveagent57 would be a better reviewer on this ticket as he did work on the original features. If @iloveagent57 is not available I can provide support. |
|
@staubina Thanks! @iloveagent57 is already reviewing it. |
|
@symbolist I am available to do another round of review also. Please ping us when you believe this is now good to be reviewed again |
|
jenkins run all |
c9e87e5 to
29f1555
Compare
|
Ah looks like I was updating the dependency in the wrong file. @schenedx I was waiting for the changes that were moved to the completion package in openedx/completion#19 to get merged and released to PyPi. They were earlier today. I have rebased this PR and updated the |
adcf2e5 to
d936874
Compare
|
@schenedx This is ready for another round of review from you. You can look at the commits starting from "Move utils to CompletionService." |
schenedx
left a comment
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.
Nice work! 👍
|
@symbolist Looks good! Could you please rebase/squash, then I'll merge this? Thanks! |
d936874 to
adaa21b
Compare
|
Your PR has finished running tests. There were no failures. |
|
@symbolist 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
|
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production on Monday, June 25, 2018. |
|
EdX Release Notice: This PR has been deployed to the production environment. |
Webviews in mobile apps do not encapsulate leaf-blocks in html for vertical blocks. Instead, they use the "chromeless-courseware"
render_xblockview. This PR adds this missing completion functionality torender_xblockview.Part of Completion API work.
Previous PR: https://github.com/edx/edx-platform/pull/16234.
JIRA tickets: OSPR-2441
Screenshots: No change to UI.
Sandbox URL: https://pr18273.sandbox.opencraft.hosting/
Merge deadline: None
Testing instructions:
/admin/waffle/switch/add and activatecompletion.enable_completion_trackingto turn on completion tracking.render_xblockview is displayed in the mobile apps.publish_completionajax call is made to the server for each child XBlock when it has been viewed from start to end for 5 seconds.render_xblockview, visit a url of the form/xblock/<block_id>. If this completion strategy is applicable to the XBlock, apublish_completionajax call is made to the server when it is viewed for the first time from start to end for 5 seconds.Reviewers