-
Notifications
You must be signed in to change notification settings - Fork 305
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
Support Stringtype, Integertype as answer option type when item type is choice. #1399
Support Stringtype, Integertype as answer option type when item type is choice. #1399
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1399 +/- ##
============================================
- Coverage 90.08% 90.07% -0.01%
- Complexity 646 648 +2
============================================
Files 129 129
Lines 9839 9843 +4
Branches 713 716 +3
============================================
+ Hits 8863 8866 +3
Misses 591 591
- Partials 385 386 +1
Continue to review full report at Codecov.
|
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 please add integer|date|time|string|Coding|Reference(Any)
as per the spec.
...com/google/android/fhir/datacapture/views/QuestionnaireItemCheckBoxGroupViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
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.
Santosh can you also implement this: #1360 (comment)
@santosh-pingle this is now a high priorty item - thanks for fixing this. |
in progress. |
datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireItemAdapter.kt
Show resolved
Hide resolved
datacapture/src/test/java/com/google/android/fhir/datacapture/MoreAnswerOptionsTest.kt
Outdated
Show resolved
Hide resolved
datacapture/src/test/java/com/google/android/fhir/datacapture/MoreAnswerOptionsTest.kt
Outdated
Show resolved
Hide resolved
datacapture/src/test/java/com/google/android/fhir/datacapture/MoreAnswerOptionsTest.kt
Outdated
Show resolved
Hide resolved
datacapture/src/test/java/com/google/android/fhir/datacapture/MoreAnswerOptionsTest.kt
Outdated
Show resolved
Hide resolved
display | ||
} | ||
} | ||
else -> throw IllegalArgumentException("$value is not supported.") |
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.
test this
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.
To test else part, it is required to set value of QuestionnaireItemAnswerOptionComponent
with not supported type, if you do so then fhir library api throws error.
throw new Error("Not the right type for Questionnaire.item.answerOption.value[x]: "+value.fhirType());
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.
ok so the QuestionnaireItemAnswerOptionComponent
class doesn't allow you to set a type that's not one of the types here. so it's sort of non-strict type safety. got it.
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.
thanks @santosh-pingle
display | ||
} | ||
} | ||
else -> throw IllegalArgumentException("$value is not supported.") |
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.
ok so the QuestionnaireItemAnswerOptionComponent
class doesn't allow you to set a type that's not one of the types here. so it's sort of non-strict type safety. got it.
IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).
Fixes #1360
Description
IntegerType
andStringType
as answer option type when item type isChoice
.Alternative(s) considered
Have you considered any alternatives? And if so, why have you chosen the approach in this PR?
Type
Choose one: Bug fix
Screenshots (if applicable)
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.