-
-
Notifications
You must be signed in to change notification settings - Fork 45
Pm-bug fixes for connect, and biometric fix #3076
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
Conversation
| String dailyFinish = getDailyFinishTime(); | ||
|
|
||
| if (dailyStart.length() == 0 || dailyFinish.length() == 0) { | ||
| if (dailyStart == "null" || dailyFinish == "null" || dailyStart.isEmpty() || dailyFinish.isEmpty()) { |
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're pushing back on doing these checks in mobile code, and instead requiring server fixes when we find they're sending the "null" string. This may have been addressed already in recent server work but if not let's submit a new ticket for them to fix it and remove the check for "null" here. @shubham1g5 Your thoughts on checking for empty string here? We just want null, correct?
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.
Think empty checks are fine to do but not "null" String checks as they seems like a server mishandling of data.
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.
| String dailyFinish = getDailyFinishTime(); | ||
|
|
||
| if (dailyStart.length() == 0 || dailyFinish.length() == 0) { | ||
| if (dailyStart == "null" || dailyFinish == "null" || dailyStart.isEmpty() || dailyFinish.isEmpty()) { |
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.
Think empty checks are fine to do but not "null" String checks as they seems like a server mishandling of data.
| private String safeString(JSONObject obj, String key) { | ||
| return obj.isNull(key) ? "" : obj.optString(key); | ||
| } |
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 we make this an Kotlin extension function so that it's accessible to other classes.
- Also can we reply with
nullinstead with empty string there as that's more correct representation of the data being sent. - call this
optStringSafeinstead to signify it's a wrapper overoptString
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.
|
|
||
| fun JSONObject.optStringSafe(key: String): String? { | ||
| val value = this.optString(key, null) | ||
| return if (this.isNull(key) || value == "null") null else value |
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.
does isNull doesn't check for "null" ?
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.
| job.dailyStartTime = JsonExtensions.optStringSafe(flags, META_DAILY_START_TIME) != null | ||
| ? JsonExtensions.optStringSafe(flags, META_DAILY_START_TIME) : ""; |
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.
you can just pass the empty string fallback to optStringSafe itself as an argument and have the fallback pass through further to optString
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.
| val value = fallback?.let { this.optString(key, it) } | ||
| return value ?: fallback |
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't we just change it to this.optString(key, fallback) irrespective of whether fallback is null or not ?
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.
| job.dailyStartTime = | ||
| JsonExtensions.optStringSafe(flags, META_DAILY_START_TIME, ""); | ||
| job.dailyFinishTime = JsonExtensions.optStringSafe(flags, META_DAILY_FINISH_TIME, ""); |
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 use some formatting.
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.
| String dailyFinish = getDailyFinishTime(); | ||
|
|
||
| if (dailyStart.length() == 0 || dailyFinish.length() == 0) { | ||
| if (dailyStart == null || dailyFinish == null || dailyStart.isEmpty() || dailyFinish.isEmpty()) { |
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.
Nit: You could use Strings.isNullOrEmpty() here to simplify this slightly
Product Description
Bug fixes
https://dimagi.atlassian.net/browse/QA-7728
QA-7729
QA-7730
QA-7727
QA-7707
cross-request:dimagi/commcare-core#1475
Technical Summary
Feature Flag
Safety Assurance
Safety story
Automated test coverage
QA Plan
Labels and Review