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

feat: validate on-wiki edits in training module #5718

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

prathamVaidya
Copy link
Contributor

@prathamVaidya prathamVaidya commented Mar 22, 2024

What this PR does

Fix 3rd task of #3500

Issue: For training modules that have on-wiki edits, check for edits to the target pages and do not register modules as complete unless such edits have been made. Shouldn't allow progress past the slide that launches them until such edits are made.

Solution:

Added functionality to check if a wiki edit button exists in slide content with a valid wiki URL then enable Wiki Edit Assignment mode which checks that if a user is logged in then do not allow them to move to the next slide until they have made an edit on the wiki page. Uses the MediaWiki API to query the last revision author.

These are the constraints:

  • user should be logged in
  • user should make the wiki edit with the same Wikipedia account.
  • last edit on the page should be from the user

Screenshots

image

Check Demo :

video.mp4

Open questions and concerns

Additionally, to detect the wiki edit button in the slide, I have added the query selector a.wiki-edit-assignment. This is to ensure that accidentally some other tag pointing to the wiki page is not used by this feature. This class name should be updated on the wiki page of the training module.

The current regex to validate a wiki URL only allows the en.wikipedia.org domain. Let me know if I should remove it.

@prathamVaidya
Copy link
Contributor Author

@ragesoss please review

@ragesoss
Copy link
Member

This is pretty different from what I had in mind. The problem the issue is trying to solve is that we have Exercise modules where the user is expected to read through the instructions, then do some on-wiki edits to actually perform the exercise, then use a 'Mark Complete' button the Dashboard top indicate that they did it... but many students click the 'Mark Complete' button without having actually followed the instructions and done the wiki edits. So we want to validate the on-wiki edits on the backend, and only allow associated exercises to be marked complete if edits to the relevant pages were made.

@prathamVaidya
Copy link
Contributor Author

oh got it.

So as per my understanding this is an example off exercise module

image

The assignment has multiple stages [ "not_yet_started", "in_progress", "ready_for_review", "ready_for_mainspace", "assignment_completed" ] and the task is to validate the edits associated with every status that has been made on the backend when user clicks "Mark Complete".

So in these 4 stages, is this how the validations should be done?

Bibliography : no validation
Sandbox : check if edits in Sandbox link
Expand your Draft : check if edits in Sandbox link
Move your work (ready_for_mainspace): check if edits in main article

Also, should the logic only check last edit or is there any other criteria?

@prathamVaidya
Copy link
Contributor Author

@ragesoss can u please confirm if the above logic is what you expect it to be? Then I can start working on it.

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.

None yet

2 participants