<commit_before>import React from 'react';
import API from './API';
import Request from 'superagent';
import _ from 'lodash';

class Result extends React.Component{

	componentWillMount(){
		this.getResult();
	}
	
	getResult(){
		var retrievedObject = localStorage.getItem('attributes');
        var answers = JSON.parse(retrievedObject);
        for (var key in answers) {
            //console.log(key)
            if (answers[key]>50) {
                    answers[key] = 1
          
            }
            else{
            	 answers[key] = 0
            }
            	
         }

         var array= Object.keys(answers).map(function(key){return answers[key];});
	// 	var value=[1,0,0,0,0,1,0,1,0,1,1,0,1,1,1,0];
	// 	var data={
	// 		value:value
	// 	}
	// 	var success = (res) => {
 //        	console.log("Got Result");
 //        	console.log(res);
 //    	}
 //    	var failure = (res) => {
 //      		console.log("Can't load Result");
 //    	}
	// 	API.post("http://localhost:3000/users/foo",data,success,failure);
		console.log(array);
	}
	render(){
		return(
			<div>
				<h1>helo</h1>
			</div>
			);
	}
}

module.exports = Result;<commit_msg>added result fetch<commit_after>import React from 'react';
import API from './API';
import Request from 'superagent';
import _ from 'lodash';

class Result extends React.Component{

  componentWillMount(){
    this.getResult();
  }

  getResult(){
    var retrievedObject = localStorage.getItem('attributes');
    var answers = JSON.parse(retrievedObject);
    for (var key in answers) {
      //console.log(key)
      if (answers[key]>50) {
        answers[key] = 1

      }
      else{
        answers[key] = 0
      }

    }

    var array= Object.keys(answers).map(function(key){return answers[key];});
    Request.post("http://localhost:3000/users/foo")
    .send({value: array})
    .end((err,res) => {
      console.log(res)
    })
    // 	var value=[1,0,0,0,0,1,0,1,0,1,1,0,1,1,1,0];
    // 	var data={
    // 		value:value
    // 	}
    // 	var success = (res) => {
    //        	console.log("Got Result");
    //        	console.log(res);
    //    	}
    //    	var failure = (res) => {
    //      		console.log("Can't load Result");
    //    	}
    // 	API.post("http://localhost:3000/users/foo",data,success,failure);
    console.log(array);
  }
  render(){
    return(
      <div>
      <h1>helo</h1>
      </div>
    );
  }
}

module.exports = Result;

{'fraction_non_alphanumeric': 0.17673653925195232, 'fraction_numerical': 0.02301685162351007, 'mean_word_length': 2.0463078848560703, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '728581', 'n_tokens_mistral': 901, 'n_tokens_neox': 848, 'n_words': 148}