{"size": 636, "ext": "js", "max_stars_repo_path": "result-loader.js", "max_stars_repo_name": "mapmeld/election-tangram", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "result-loader.js", "max_issues_repo_name": "mapmeld/election-tangram", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "result-loader.js", "max_forks_repo_name": "mapmeld/election-tangram", "max_forks_repo_forks_event_min_datetime": "2018-07-13T20:05:08.000Z", "max_forks_repo_forks_event_max_datetime": "2018-07-13T20:05:08.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 30.2857142857, "max_line_length": 119, "alphanum_fraction": 0.6650943396}
var fs = require('fs');

var lowerhouse = require('./data/lowerhouse.geo.json');
var candidates = require('./data/final_lower_house.json');

for (var f = 0; f < lowerhouse.features.length; f++) {
  for (var c = 0; c < candidates.length; c++) {
	  if (candidates[c].votes > 0 && candidates[c].constituency.TS_PCODE === lowerhouse.features[f].properties.TS_PCODE) {
		  lowerhouse.features[f].properties.winner = candidates[c].party_id || -1
		  //console.log('found winner');
	  }
  }
}

fs.writeFile('./data/lowerhouse-winners.geojson', JSON.stringify(lowerhouse), function (err) {
	if (err) {
		throw err;
	}
	console.log('done');
});
