-
Notifications
You must be signed in to change notification settings - Fork 60
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
Delete saved draft feature #3631
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3631 +/- ##
=========================================
+ Coverage 27.3% 27.4% +0.1%
- Complexity 787 789 +2
=========================================
Files 282 282
Lines 14699 14695 -4
Branches 2634 2632 -2
=========================================
+ Hits 4023 4040 +17
+ Misses 10132 10100 -32
- Partials 544 555 +11
Flags with carried forward coverage won't be shown. Click here to find out more.
|
move delete draft classes to questionnaire package
Add ability to set alert dialog button color
@@ -43,6 +43,12 @@ enum class AlertIntent { | |||
|
|||
data class AlertDialogListItem(val key: String, val value: String) | |||
|
|||
data class AlertDialogButton( |
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.
nice refactor!
defaultRepository.update(questionnaireResponse) | ||
defaultRepository.addOrUpdate( |
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.
In the unlikely event that one passes and the other fails, might be best to wrap this with a DB transaction.
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.
We'd probably want to create a new method in defaultRespository for this and then within it use the txn block
fhirEngine.withTransaction {
...
}
...d/engine/src/test/java/org/smartregister/fhircore/engine/data/local/DefaultRepositoryTest.kt
Outdated
Show resolved
Hide resolved
val questionnaireResponse = | ||
defaultRepository.searchQuestionnaireResponse( | ||
resourceId = questionnaireConfig.resourceIdentifier!!, | ||
resourceType = questionnaireConfig.resourceType!!, | ||
questionnaireId = questionnaireConfig.id, | ||
encounterId = null, | ||
questionnaireResponseStatus = QuestionnaireResponseStatus.INPROGRESS.toCode(), | ||
) | ||
|
||
if (questionnaireResponse != null) { | ||
questionnaireResponse.status = QuestionnaireResponseStatus.STOPPED | ||
defaultRepository.update(questionnaireResponse) | ||
defaultRepository.addOrUpdate( |
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.
Unless this is covered by another test we can add a unit test to verify that this method QuestionnaireDraftDialogViewModel.deleteDraft
,
- Searches for for the QuestionnaireResponse
- Updates the QuestionnaireResponse
- Creates the AuditEvent
Co-authored-by: Martin Ndegwa <[email protected]>
Missing change on adding the transaction block
* Add delete draft workflow * Add view model * Add logic for soft deleteing drafts * Run the search for QuestinnaireResponse in view model scope * Move searchQuestionnaireResponse function to default repository * Use interpolated questionnaire config when launching delete draft fragment * Ensure delete draft db calls complete before dialog is dismissed * Add flag to indicate a drft has been deleted * Use aduti event to keep track of deleted drafts * Rename delete draft questionnaire workflow move delete draft classes to questionnaire package * Rename draft dialog fragment and view model * Add data class to hold alert dialog button properties Add ability to set alert dialog button color * Fix failing tests * Update CHANGELOG.md * Verify filtering by encounter works when when searching for latest QR * Run spotless Apply * Update test name Co-authored-by: Martin Ndegwa <[email protected]> * Add documentation for delete draft functionality * Add qustionnaire draft dialog view tests * Run questionnaire soft deletion and audit event creation in a transaction block * Update docs --------- Co-authored-by: Martin Ndegwa <[email protected]>
* Add delete draft workflow * Add view model * Add logic for soft deleteing drafts * Run the search for QuestinnaireResponse in view model scope * Move searchQuestionnaireResponse function to default repository * Use interpolated questionnaire config when launching delete draft fragment * Ensure delete draft db calls complete before dialog is dismissed * Add flag to indicate a drft has been deleted * Use aduti event to keep track of deleted drafts * Rename delete draft questionnaire workflow move delete draft classes to questionnaire package * Rename draft dialog fragment and view model * Add data class to hold alert dialog button properties Add ability to set alert dialog button color * Fix failing tests * Update CHANGELOG.md * Verify filtering by encounter works when when searching for latest QR * Run spotless Apply * Update test name Co-authored-by: Martin Ndegwa <[email protected]> * Add documentation for delete draft functionality * Add qustionnaire draft dialog view tests * Run questionnaire soft deletion and audit event creation in a transaction block * Update docs --------- Co-authored-by: Martin Ndegwa <[email protected]>
IMPORTANT: Where possible all PRs must be linked to a Github issue
Fixes #3605
Link to docs
Engineer Checklist
strings.xml
file./gradlew spotlessApply
and./gradlew spotlessCheck
to check my code follows the project's style guideCode Reviewer Checklist
strings.xml
file