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

CARDS-2510: Fix computed questions always recalculating on checkin #1752

Merged
merged 2 commits into from
Jun 17, 2024

Conversation

acrowthe
Copy link
Contributor

@acrowthe acrowthe commented Apr 4, 2024

  • Fix computed questions being recalculated by the backend whenever the front end submits the a form with no relevant changed answers

To ensure that computed questions are working as expected:

  • Launch in runmode test with --dev enables

  • Sign in to user: computedtestuser password: testpassword

  • Create a Backend Computed Question form but do not input any answers or save it

  • Check the created form using composum. It should have 2 sections, one with 4 answers and one with 8 answers.

    • Check the section with 8 answers: Two should have strings describing the (lack of) values in Question 4
      image
  • Save the form with no edited answers

  • Create a new Backend Computed Question form, fill out all answers and save it.

  • Sign out of computedtestuser and sign into admin

  • View the created forms in view mode only and verify that the answers are as expected

To ensure that the computed questions are only being recalculated when desired:

  • Launch cards in runmode test with --dev and a debugger attached
  • Put breakpoints on ComputedAnswersEditor.computeAnswers on lines 194 and 199 as shown below:
    image
  • Verify that the line 194 breakpoint is being hit whenever the computation shouldn't be saved
  • Verify that the line 199 breakpoint is being hit whenever the computation should be saved:
    • When a form is created all computed questions should be calculated
    • When the question does not take any other question inputs (seen by 1 question always computing with result=1)
    • When the form is modified by a user that does not have access to the computed questions and modifies an input answer

- Fix computed questions being recalculated by the backend whenever the front end submits the a form with no relevant changed answers
@marta- marta- requested a review from sdumitriu May 13, 2024 18:00
@acrowthe acrowthe changed the title Fix computed questions always recalculating on checkin CARDS-2510: Fix computed questions always recalculating on checkin May 13, 2024
@marta- marta- requested a review from sashaandjic May 13, 2024 18:00
@sashaandjic
Copy link
Contributor

tested up to the Launch cards in runmode test with --dev and a debugger attached point in testing instructions

- Change incorrect code comment
- Fix a case where a changed computed answer wouldn't be marked as changed
@marta- marta- requested a review from sdumitriu June 13, 2024 15:09
@marta- marta- added the urgent Needs to be completed and merged asap label Jun 13, 2024
@sdumitriu sdumitriu merged commit 9dc807d into dev Jun 17, 2024
@sdumitriu sdumitriu deleted the CARDS-2510 branch June 17, 2024 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
urgent Needs to be completed and merged asap
Projects
None yet
4 participants