-
Notifications
You must be signed in to change notification settings - Fork 22
fixing bug when id is array of string all #349
Conversation
Codecov Report
@@ Coverage Diff @@
## master #349 +/- ##
======================================
Coverage 8.95% 8.95%
======================================
Files 234 234
Lines 2568 2568
======================================
Hits 230 230
Misses 2338 2338
Continue to review full report at Codecov.
|
Note: This PR does not fix the pre-commit warnings/errors that I raised on #223 |
@@ -66,7 +66,7 @@ export function generateActions (resourceName, getResource, afterGet) { | |||
// We filter them, then pass them along to the service (for example lib/gw2/readCalculatedItemStats) | |||
// If calculatedId exists, use that. | |||
const actualId = +(typeof id === 'object' ? (id.calculatedId || id.id) : id); | |||
const isValidId = actualId && actualId !== -1; | |||
const isValidId = (id === 'all') || (actualId && actualId !== -1); |
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 for your first contribution! :))
is this really needed though? the current logic actualId && actualId !== -1
would return true for the string 'all'
.
> 'all' && 'all' !== -1
true
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.
actualId was not 'all', it was NaN. Maybe because of the + right after the assignment equals?
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.
ah, good catch. that'll do it.
can you add a test case for this pls? the reducer/action logic is pretty well tested (compared to the rest of the code base.. haha)
Closing this PR for now. I separated the bugfix out from the achievement feature. |
No description provided.