-
Notifications
You must be signed in to change notification settings - Fork 249
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
Fixed Showing no validation errors when form opens #1102
Conversation
Can you please update the PR template. You can refer to other PRs to know how to do this. eg: #1106 |
thanks, just updated the template. |
…android-fhir into 1001-fix-form-validation
Codecov Report
@@ Coverage Diff @@
## master #1102 +/- ##
============================================
- Coverage 83.72% 83.60% -0.12%
+ Complexity 678 677 -1
============================================
Files 147 147
Lines 10670 10676 +6
Branches 862 866 +4
============================================
- Hits 8933 8926 -7
Misses 1287 1287
- Partials 450 463 +13
Continue to review full report at Codecov.
|
Please take a look at this section of the wiki: https://github.com/google/android-fhir/wiki/Structured-Data-Capture-Library#provide-configuration |
discussed offline with @aurangzaibumer: @ellykits and @aurangzaibumer please consider using the If that is indeed a problem, then please let us know so we can make sure the APIs are easy to use. Just a final note, this way of providing library config is consistent with other android libraries such as work manager. |
@jingtang10 This is well noted. There was no problem using the Note that it is possible to provide a custom application for Hilt tests however for best practices it is not recommended to avoid accidental leaks of state used in the application class, that is documented here Hilt custom test application. As an alternative approach to implementing the |
thanks @ellykits - i don't really understand the reasoning behind Hilt's recommendation besides "it's easy to get it wrong". @yigit @stevenckngaa @kevinmost fyi. let me do some research and get back to you on this one. |
Sounds like the main concern is that it introduces a stronger coupling between your Hilt Application and the component (Fragment, Activity, etc)? |
…android-fhir into 1001-fix-form-validation
i chatted with someone working on hilt and they said: so i think it's ok to use the custom application in testing as long as we're aware of the potential (avoidable) issues. |
Cool thanks.
…On Wed, Feb 16, 2022, 12:30 Jing Tang ***@***.***> wrote:
i chatted with someone working on hilt and they said: It is just a
'recommendation', we know it might not be possible for all situations to
only use the HiltTestApplication which is why there is also an API for
custom applications.
—
Reply to this email directly, view it on GitHub
<#1102 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGM667BL4B4OUKECQOB4CDLU3NVD5ANCNFSM5NLRF7UA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
…android-fhir into 1001-fix-form-validation
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.
Can you add a test case for RequiredConstraintValidator.kt
?
Actually if you do this, you can probably remove the new test cases you added in the boolean and single line widgets' tests.
...oid/fhir/datacapture/views/QuestionnaireItemAutoCompleteViewHolderFactoryInstrumentedTest.kt
Show resolved
Hide resolved
...ir/datacapture/views/QuestionnaireItemEditTextSingleLineViewHolderFactoryInstrumentedTest.kt
Outdated
Show resolved
Hide resolved
.../src/main/java/com/google/android/fhir/datacapture/validation/RequiredConstraintValidator.kt
Outdated
Show resolved
Hide resolved
I've added few test cases for the |
# Conflicts: # datacapture/src/main/java/com/google/android/fhir/datacapture/views/QuestionnaireItemEditTextViewHolderFactory.kt
…yInstrumentedTest
…android-fhir into 1001-fix-form-validation
.../test/java/com/google/android/fhir/datacapture/validation/RequiredConstraintValidatorTest.kt
Outdated
Show resolved
Hide resolved
.../test/java/com/google/android/fhir/datacapture/validation/RequiredConstraintValidatorTest.kt
Outdated
Show resolved
Hide resolved
.../test/java/com/google/android/fhir/datacapture/validation/RequiredConstraintValidatorTest.kt
Outdated
Show resolved
Hide resolved
...hir/datacapture/views/QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest.kt
Outdated
Show resolved
Hide resolved
...ir/datacapture/views/QuestionnaireItemEditTextSingleLineViewHolderFactoryInstrumentedTest.kt
Outdated
Show resolved
Hide resolved
...hir/datacapture/views/QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest.kt
Outdated
Show resolved
Hide resolved
...hir/datacapture/views/QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest.kt
Outdated
Show resolved
Hide resolved
…validation/RequiredConstraintValidatorTest.kt Co-authored-by: Jing Tang <[email protected]>
…apture/views/QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest.kt Co-authored-by: Jing Tang <[email protected]>
Comments are resolved. Can you please review @jingtang10 . Thanks |
什么
…---Original---
From: ***@***.***>
Date: Thu, Apr 7, 2022 01:10 AM
To: ***@***.***>;
Cc: ***@***.***>;
Subject: Re: [google/android-fhir] Fixed Showing no validation errors whenform opens (PR #1102)
Comments are resolved. Can you please review @jingtang10 . Thanks
cc @f-odhiambo
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Unable to update with master branch @jingtang10 |
fixed, can update now. |
...oid/fhir/datacapture/views/QuestionnaireItemAutoCompleteViewHolderFactoryInstrumentedTest.kt
Show resolved
Hide resolved
...hir/datacapture/views/QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest.kt
Show resolved
Hide resolved
I think the test failures reveal a problem with this code change. we're relying on the difference between a questionnaire item without answer, and a questionnaire with an answer without value to distinguish questions that have been answered but the answers have been cleared and questions that have not been answered. but this is not strong enough. problem 1) hapi actually doesn't make this distinction. The i think we probably should introduce a "dirty" field for each question in the view model. |
Two possible solutions (pending investigation):
|
New PR Link #1309 |
Fixes
#1001 #opensrp/fhircore#873
Description
Removed validation from being triggered when user opens the form and enters no data.
Type
Choose one: ( Bug fix)
Screenshots (if applicable)
https://user-images.githubusercontent.com/35099184/152525877-d7d52896-3063-4925-903e-159a34d86a32.mp4
Checklist
./gradlew spotlessApply
and./gradlew spotlessCheck
to check my code follows the style guide of this project./gradlew check
and./gradlew connectedCheck
to test my changes locally