Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@01painadam
Copy link
Contributor

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.js file.

Notes

As always, please test.

This widget will also likely need pagination on the global page in the future.

@01painadam 01painadam changed the base branch from develop to feature/global-dashboard May 9, 2018 14:11
@01painadam 01painadam requested a review from edbrett May 9, 2018 14:11
if (gainData && gainData.length) {
mappedData = gainData.map(item => {
const gain = item.gain ? item.gain : 0;
const extent = item.value ? item.value : 0;
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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.

@edbrett edbrett merged commit 0a9d267 into feature/global-dashboard May 11, 2018
@edbrett edbrett deleted the feature/global-gain-ranked branch May 11, 2018 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants