-
Notifications
You must be signed in to change notification settings - Fork 95
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
Do not treat 0 as boolean value in the REST controller #1276
Conversation
This is now overlapping with #1267 by @miguelvaara - there are changes to the same lines in ConceptSearchParameters.getSearchTerm. These need to be consolidated somehow. Maybe simply by merging one first, then fixing the conflicts in the other. |
Rebased, GH Actions working 🧰 thanks @osma ! |
Codecov Report
@@ Coverage Diff @@
## master #1276 +/- ##
============================================
+ Coverage 69.33% 69.36% +0.02%
- Complexity 1648 1649 +1
============================================
Files 32 32
Lines 4047 4047
============================================
+ Hits 2806 2807 +1
+ Misses 1241 1240 -1
Continue to review full report at Codecov.
|
The code looks good - I think the easiest way forward is to merge this first and then sort out the conflicts in PR #1267, as that one is still a bit WIP (at least the PR description is outdated). The only thing I wonder about is the title of this PR (and the commit message) which says "Do not treat 0 as truthy value". Isn't the point actually the opposite - "Do not treat 0 as a non-truthy (i.e. false) value"? |
You're right! s/truthy/boolean , WDYT? |
Sounds good! |
@@ -86,6 +86,26 @@ public function testGetSearchTerm() { | |||
$this->assertEquals('test', $params->getSearchTerm()); | |||
} | |||
|
|||
/** | |||
* For https://github.com/NatLibFi/Skosmos/issues/1275, to verify | |||
* that querying for `0` (zero) does not evaluate it as a truthy |
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.
s/truthy/boolean/ here as well?
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.
Oh, missed that one. Just a sec.
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.
Done. That should be the last one ™
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.
Famous last words!
SonarCloud Quality Gate failed. 0 Bugs No Coverage information |
Will do one final test round and then merge! |
Works like a charm! Thanks a lot @kinow ! |
Reasons for creating this PR
Prevent
0
being treated as a truthy value in the REST controller. Complements #1261Link to relevant issue(s), if any
Description of the changes in this PR
Same fix as #1261
Known problems or uncertainties in this PR
None.
Checklist