-
Notifications
You must be signed in to change notification settings - Fork 9
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: handle the deletion of subtemplate answers #918
base: develop
Are you sure you want to change the base?
Conversation
4225f6b
to
68a1ced
Compare
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.
Looks good except a few comments.
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.
Looks fine. But can we add an e2e.
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.
Looks fine. But can we add an e2e.
|
||
unsatisfiedDependencyQues.forEach(async (subTemplateQues) => { | ||
const config = subTemplateQues.config as SubTemplateConfig; | ||
await this.deleteSubTemplatesAnswers( |
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.
This will not be awaited, because forEach
does not await the function body statements.
Maybe use Promise.all
with map or a for ... of
This might now show as a problem if you do not expect immediate update latter in the code.
return; | ||
} | ||
|
||
genericTemplates.forEach(async (genericTemplate) => { |
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 same issue with the await is here
Description
This PR introduces a fix to clear the answers of dependent generic template questions when their conditions are not satisfied.
Motivation and Context
The change is required to maintain the integrity of the data and avoid any confusion or misinformation due to the persistence of answers that are no longer relevant or correct. This improves the user experience and ensures the accuracy of the information presented to the users.
Changes
deleteOldAnswers
function to includeanswers
andagent
parameters to better handle the deletion process.deleteSubTemplatesAnswers
function to handle the deletion of subtemplate answers when their parent question's conditions are not met.How Has This Been Tested?
Fixes Issue
UserOfficeProject/issue-tracker#1261
Depends On
Tests included/Docs Updated?