Skip to content

Commit

Permalink
Updated change url + bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
raghavmecheri committed Sep 26, 2019
1 parent a24b94f commit ae80606
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 6 additions & 1 deletion server/handlers/DataReadHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
9 changes: 7 additions & 2 deletions src/components/RevealPrice.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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(
<div className="vertCenter">
<h4 className="centerTitle" style={priceHoldStyle}>Your Data's Value: {formatter.format(props.priceInfo.value.dataValue)}</h4>
{
advertisers ? (
platform == "Facebook" ? (
<React.Fragment>
<h4 className="centerTitle" style={priceHoldStyle}>Advertisers who interact with your information: {advertisers}</h4>
<h4 className="centerTitle" style={priceHoldStyle}>If you took 10% on each advertiser sale: {formatter.format(props.priceInfo.value.dataValue*advertisers * 0.10)}</h4>
Expand Down

0 comments on commit ae80606

Please sign in to comment.