From ae8060683475cd2da0bff2c23a6db7b84226dc66 Mon Sep 17 00:00:00 2001 From: Raghav Mecheri Date: Thu, 26 Sep 2019 00:20:49 -0400 Subject: [PATCH] Updated change url + bugfixes --- server/handlers/DataReadHandler.js | 7 ++++++- src/components/RevealPrice.js | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/server/handlers/DataReadHandler.js b/server/handlers/DataReadHandler.js index ac59cc7..39f1387 100644 --- a/server/handlers/DataReadHandler.js +++ b/server/handlers/DataReadHandler.js @@ -57,7 +57,7 @@ const processZipFile = (zipData, valueMap, fileStructure, entryMap, isGoogle) => resolve({dataValue, totalEntries}) // console.log(JSON.stringify(fileData)); }).catch((err) => { - + console.log("Caught inner error"); }) // console.log(dataValue); // console.log(advertisers); @@ -155,6 +155,11 @@ const getNestedValue = (nestedValue, inputVector) => { let maxLen = nestedList.length; let count = 0; nestedList.forEach( async (element) => { + if(!childJson || !childJson.hasOwnProperty(element)) { + console.log("Absence of key. Returning") + // Prevents crashes when property is absent + resolve(0); + } childJson = childJson[element]; count +=1; if(count >= maxLen) { diff --git a/src/components/RevealPrice.js b/src/components/RevealPrice.js index a8afc7b..99449bc 100644 --- a/src/components/RevealPrice.js +++ b/src/components/RevealPrice.js @@ -9,7 +9,7 @@ import React, {Component} from 'react'; import Button from 'react-bootstrap/Button' import "../styles/HomeStyle.css" -const CHANGE_URL = "https://binit.in"; +const CHANGE_URL = "https://www.change.org/p/pricemydata-we-should-get-a-cut-of-our-data-revenues?recruiter=946872792&utm_source=share_petition&utm_medium=copylink&utm_campaign=share_petition"; const priceHoldStyle = { paddingRight: "1vh", @@ -25,13 +25,18 @@ export default function RevealPrice(props) { currency: 'USD', minimumFractionDigits: 2 }) + let platform = props.platformName let advertisers = props.priceInfo.value.totalEntries.advertisers; + let amount = props.priceInfo.value.dataValue + if(amount == 0) { + alert("Hey! We couldn't help but notice that your resultant amount was $0. That's super rare - are you sure you uploaded the right .zip file?") + } return(

Your Data's Value: {formatter.format(props.priceInfo.value.dataValue)}

{ - advertisers ? ( + platform == "Facebook" ? (

Advertisers who interact with your information: {advertisers}

If you took 10% on each advertiser sale: {formatter.format(props.priceInfo.value.dataValue*advertisers * 0.10)}