{"size": 833, "ext": "js", "max_stars_repo_path": "frontend_3.0/src/NFL-Components/MatchupCalculator.js", "max_stars_repo_name": "plopez9/chipy_sports_app_2.0", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "frontend_3.0/src/NFL-Components/MatchupCalculator.js", "max_issues_repo_name": "plopez9/chipy_sports_app_2.0", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "frontend_3.0/src/NFL-Components/MatchupCalculator.js", "max_forks_repo_name": "plopez9/chipy_sports_app_2.0", "max_forks_repo_forks_event_min_datetime": "2019-10-08T17:39:08.000Z", "max_forks_repo_forks_event_max_datetime": "2019-10-08T17:39:08.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 21.9210526316, "max_line_length": 95, "alphanum_fraction": 0.5930372149}
import React, { Component } from "react";

class Calculator extends Component{
  constructor(props){
    super(props);
  }

  render(){

    let score1 = this.props.pinfo.map(item => item.average_points_scored)
    let std1 = this.props.pinfo.map(item=> item.std)

    let score2 = this.props.oppTeam.map(item => item.points_allowed)
    let std2 = this.props.oppTeam.map(item=> item.std)
    let delta = Math.max(score1, score2)-Math.min(score1,score2)
    var ratio = 1

    if (score1 > score2){
      var ratio = std2/std1
    } else{
      var ratio = std1/std2
    }


      return(
        <div className="topHalf">
          <h1> Matchup Rating </h1>

          <h2> {(Math.min(score1, score2) + delta * (1/(1+Math.exp(-4*(ratio-1))))).toFixed(2)}
          </h2>
        </div>
      );
    }
}


export default Calculator;
