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

[Candidate_parameters] Improve front-end validation for entering Consent data #4034

Merged
merged 2 commits into from
Feb 11, 2019

Conversation

zaliqarosli
Copy link
Contributor

@zaliqarosli zaliqarosli commented Oct 29, 2018

Brief summary of changes

This PR makes entering consent data more rigorous. Going forward, this PR implements the following workflow for data entry:

  • Date of consent being given is required for both answers to consent "yes" or "no"
  • Date of withdrawal of consent required if answer changes from "yes" to "no"
  • Consent status "yes" or "no" cannot be changed to an empty one
  • Replaces confirmation message to swal
  • Adds script to check errors in data

To test this change...

  1. Date of Withdrawal field should be disabled until it is needed.
  2. For a currently empty consent status field, change status to "yes". Date of Consent should be required.
  3. For a currently empty consent status field, change status to "no". Date of Consent should be required. Date of withdrawal still disabled.
  4. For a consent status field with a "yes" status, change answer to "no". Date of Withdrawal should be enabled and required. Save answer.
  5. Change the same status field back to "yes". Date of Withdrawal is disabled and the date cleared.
  6. For a consent status field with a "no" or "yes" status, you cannot change it back to empty.

Note for reviewing: While there are plenty of pre-ES6 syntax, conversion of vars to lets/consts does not belong in this PR. All new code highlighted in green should already conform to ES6 standards.

@zaliqarosli zaliqarosli added Area: UI PR or issue related to the user Interface Cleanup PR or issue introducing/requiring at least one clean-up operation [branch] minor labels Oct 29, 2018
@zaliqarosli zaliqarosli changed the title [Candidate_parameters] Improve validation for entering Consent data [Candidate_parameters] Improve front-end validation for entering Consent data Oct 29, 2018
@me-evans
Copy link

me-evans commented Oct 30, 2018

As discussed in today's LORIS meeting, weighing in re: proposed consent changes. This is great, just have a few minor adjustments to request.

  • Date of consent being given is required for both answers to consent "yes" and "no"
    • Agree completely
  • Date of withdrawal of consent required if answer changes from "yes" to "no"
    • Agree, just propose also blocking them from :
      • Entering Date of withdrawal as the first date with either Yes or No
        • Reason: To prevent errors and to enforce a proper consent history
          • Ex. If consent is withdrawn before user has recorded consent given, we should still require that an entry of 'Yes' with the 'Date of Consent' be saved before allowing a new entry with the 'No' / 'Date of Withdrawal' combo
      • Entering a 'Date of Withdrawal' if the consent is still 'Yes'
  • If "yes" or "no" answer to consent already exists, the current status cannot be erased to an empty answer
    • Agree with @LeighMac that some users (those who can edit candidate parameters) should be able to remove entries made by mistake.
    • Could remove blank option in status menu once a 'yes' or 'no' has been saved and instead have a separate, explicit button for clearing the last consent update in case of error.
      • Button triggers pop-up with warning to only proceed if entry was made by mistake (ex. wrong candidate) and instructions to update consent instead if not erasing an error
      • User must select either 'Proceed' to clear last status/date or 'Dismiss' to return to main

@zaliqarosli
Copy link
Contributor Author

zaliqarosli commented Nov 1, 2018

Changes made :

  1. Date of Withdrawal field is disabled by default. It is enabled when either :
  • consent is being withdrawn (status changes from "yes" to "no") OR
  • date of withdrawal already exists (allows user to remove/change date)
  1. Date of Withdrawal field is required when:
  • consent is being withdrawn (status changes from "yes" to "no")
  1. Removed disallowing users to erase a valid status as the ideal workflow drawn out above requires more work to be done. A GitHub issue can be made to address this @me-evans . Please review code to double check the logic for points 1 and 2. I added comments to make the code human readable.

edit: latest workflow updated in PR description

withdrawalRequired[i] = false;
// If answer to consent is "no", require date of consent
if (this.state.formData[consent] === "no") {
dateRequired[i] = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

should this have a default value set to it as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

may as well!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zaliqarosli zaliqarosli added the State: Needs rebase PR that needs to be rebased to proceed (conflicts, wrong branch...) label Nov 12, 2018
@zaliqarosli zaliqarosli force-pushed the 2018-10-29-ImproveConsentValidation branch from 08a0106 to b386b5f Compare November 12, 2018 18:05
@zaliqarosli zaliqarosli removed the State: Needs rebase PR that needs to be rebased to proceed (conflicts, wrong branch...) label Nov 12, 2018
@ridz1208
Copy link
Collaborator

@zaliqarosli just tested this, minor changes needed.

  • I cant seem to be able to clear the date of withdrawal and save
  • whenthe consent changes from yes/no to empty, the date fields should all be cleared.

@zaliqarosli
Copy link
Contributor Author

zaliqarosli commented Nov 27, 2018

PR description updated to address Rida's comments above. Issue created to follow up on solving how to clear consent

@zaliqarosli zaliqarosli force-pushed the 2018-10-29-ImproveConsentValidation branch from d648b23 to e133af4 Compare November 29, 2018 20:01
@ridz1208 ridz1208 added the State: Needs work PR awaiting additional work by the author to proceed label Dec 7, 2018
@ridz1208
Copy link
Collaborator

ridz1208 commented Dec 7, 2018

@zaliqarosli still not working

@ridz1208
Copy link
Collaborator

ridz1208 commented Dec 7, 2018

@zaliqarosli new rules need to be applied on the backend through a release script

@zaliqarosli zaliqarosli force-pushed the 2018-10-29-ImproveConsentValidation branch from 7011aab to b83f140 Compare December 7, 2018 23:40
@zaliqarosli zaliqarosli added "Help! I don't understand Travis!" PR is having a beef with TRAVIS. Someone needs to help and removed "Help! I don't understand Travis!" PR is having a beef with TRAVIS. Someone needs to help State: Needs work PR awaiting additional work by the author to proceed labels Dec 7, 2018
@zaliqarosli
Copy link
Contributor Author

@ridz1208 please re-review!

tools/single_use/Cleanup_Consent_Data.php Outdated Show resolved Hide resolved
@zaliqarosli
Copy link
Contributor Author

@ridz1208 done. please re-review

@ridz1208 ridz1208 self-assigned this Jan 25, 2019
Copy link
Collaborator

@ridz1208 ridz1208 left a comment

Choose a reason for hiding this comment

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

EVERYTHING ELSE LOOKS GOOD

tools/single_use/Cleanup_Consent_Data.php Outdated Show resolved Hide resolved
travis

add disabled withdraw

revamp logic

travis

add clarity

travis

ridas request

cleanup

cleanup

backend validation

dont give users the option to throw an error

travis

travis

travis

travis

travis

travis

validation for dirty data

cleanup

add cleanup script

lint php

travis

travis

change DB
@zaliqarosli zaliqarosli force-pushed the 2018-10-29-ImproveConsentValidation branch from 5b3519d to 6a0876c Compare February 4, 2019 17:23
@ridz1208 ridz1208 added the Passed manual tests PR has been successfully tested by at least one peer label Feb 5, 2019
@driusan driusan merged commit 9ef6e11 into aces:minor Feb 11, 2019
@ridz1208 ridz1208 added this to the 20.3.0 milestone Mar 14, 2019
kchatpar pushed a commit to kchatpar/Loris that referenced this pull request Apr 15, 2019
…ent data (aces#4034)

This makes entering consent data more rigorous. Implements the following workflow for data entry:

- Date of consent being given is required for both answers to consent "yes" or "no"
- Date of withdrawal of consent required if answer changes from "yes" to "no"
- Consent status "yes" or "no" cannot be changed to an empty one
- Replaces confirmation message to swal
- Adds script to check errors in data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: UI PR or issue related to the user Interface Cleanup PR or issue introducing/requiring at least one clean-up operation Passed manual tests PR has been successfully tested by at least one peer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants