Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Fix sentiment dereference for latest model changes #110

Merged
merged 2 commits into from Aug 17, 2017
Merged

Conversation

c-w
Copy link
Contributor

@c-w c-w commented Aug 17, 2017

Made necessary by changes in this pull request
CatalystCode/project-fortis-pipeline#118

*/
function computedtileToTile(row) {
const coordinates = [geotile.longitudeFromColumn(row.tiley, row.tilez), geotile.latitudeFromRow(row.tilex, row.tilez)];
const mentionCount = row.mentioncount;
const neg_sentiment = row.avgsentiment;
const neg_sentiment = row.avgsentimentnumerator / row.mentioncount;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd guard against row.mentioncount = 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Division by zero is safe(-ish) in Javascript (just gives you infinity), but sure, let's make it explicit: 62c0ee2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting I didn't know that.

Copy link
Contributor

@Smarker Smarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@c-w c-w merged commit 376c80d into master Aug 17, 2017
@c-w c-w deleted the fix-sentiment branch August 17, 2017 22:17
@c-w c-w removed the in progress label Aug 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants