-
Notifications
You must be signed in to change notification settings - Fork 96
Feature/global gain ranked #3402
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
| if (gainData && gainData.length) { | ||
| mappedData = gainData.map(item => { | ||
| const gain = item.gain ? item.gain : 0; | ||
| const extent = item.value ? item.value : 0; |
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 use item.value || 0
| const locationData = | ||
| currentLocation && data.find(l => l.id === currentLocation.value); | ||
| const gain = locationData && locationData.gain; | ||
| currentLabel && data.find(l => l.id === currentLabel.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.
currentlLabel is a string not an object. This should fail. Use currentLocation if you need the value
| } = sentences; | ||
| const locationData = currentLabel && data.find(l => l.id === currentLabel); | ||
| const locationData = | ||
| currentLabel && data.find(l => l.id === currentLocation.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.
you are using currentLabel for checking. This should be the same as the comparison at the end of the line.
Overview
Prepares the Ranked Gain widget in the face of impending globalisation.
The bonus mayo on this pr-sandwich is that it also fixes a hither-to-unseen bug in the relative gain calculations, which also helped slim down the code in the
action.jsfile.Notes
As always, please test.
This widget will also likely need pagination on the global page in the future.