Skip to content
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

fix(palm): receive XBlock visibility from the Learning MFE #662

Conversation

Agrendalath
Copy link
Member

@Agrendalath Agrendalath commented May 23, 2024

Currently, the LMS retrieves the viewport information with getBoundingClientRect. However, it doesn't work correctly when the XBlocks are rendered in an iframe because the iframe is automatically resized to its full height.

This solves the described problem by sending the visibility status from the Learning MFE to the LMS.

Testing instructions:

  1. (Optional) Set COMPLETION_BY_VIEWING_DELAY_MS = 1000 in lms/envs/private.py for easier testing. The default value is 5000.
  2. (Optional) Change publish_completion to publish_completions in lms/static/completion/js/CompletionOnViewService.js for easier testing. Otherwise, you will need to create a new XBlock for the next check or manually remove the BlockCompletion object from the DB to get the API call re-triggered the next time you view it.
  3. Check out the current PR and fix(palm): send XBlock visibility status to the LMS frontend-app-learning#16.
  4. Create an HTML block with a single line. Check that the publish_completion request is called in both the Learning MFE and the Preview (to check for regressions).
  5. Create two HTML blocks with enough lines to exceed your viewport. Check that the publish_completion request is called when you scroll down to the bottom of each of these blocks (in the Learning MFE and Preview).

Private-ref: BB-8826

Copy link
Member

@xitij2000 xitij2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

  • I tested this: tested on palm tutor devstack
  • I read through the code

lms/static/completion/js/ViewedEvent.js Outdated Show resolved Hide resolved
@Agrendalath Agrendalath force-pushed the agrendalath/bb-8826-completion-in-the-learning-mfe branch from ff9e2fc to c99dc3b Compare September 16, 2024 13:10
The old version does not work in the CI anymore.
@Agrendalath
Copy link
Member Author

Palm-specific tests are passing. Merging.

@Agrendalath Agrendalath merged commit 446a483 into opencraft-release/palm.1 Sep 16, 2024
41 checks passed
@Agrendalath Agrendalath deleted the agrendalath/bb-8826-completion-in-the-learning-mfe branch September 16, 2024 13:47
@Agrendalath Agrendalath changed the title fix: receive XBlock visibility from the Learning MFE fix(palm): receive XBlock visibility from the Learning MFE Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants