Old Stats/2018-stats-compiler.js
//updateTeams translates the schedule into proper statistical data for teams
updateTeams translates the schedule into proper statistical data for teams
updateTeams translates the schedule into proper statistical data for teams
function updateTeams(arr){
  for (var i = 0; i < arr.length; i++){
    arr[i].home.gp += 1;
    arr[i].away.gp += 1;
    if (arr[i].Hscore > arr[i].Ascore){
      arr[i].home.won += 1;
      arr[i].away.lost += 1;
      arr[i].home.points += 3;
    };
    if (arr[i].Ascore > arr[i].Hscore){
      arr[i].away.won += 1;
      arr[i].home.lost += 1;
      arr[i].away.points += 3;
    };
    if (arr[i].Hscore == arr[i].Ascore){
      arr[i].home.points += 1;
      arr[i].away.points += 1;
      arr[i].home.drawn += 1;
      arr[i].away.drawn += 1;
    };
    var goalDifferential = (arr[i].Hscore - arr[i].Ascore);
    arr[i].home.gf += arr[i].Hscore;
    arr[i].home.ga += arr[i].Ascore;
    arr[i].home.gd += goalDifferential;
    arr[i].away.gf += arr[i].Ascore;
    arr[i].away.ga += arr[i].Hscore;
    arr[i].away.gd -= goalDifferential;
  };
}
function updateTeams ( arr ) { for ( var i = 0 ; i < arr . length ; i ++ ) { arr [ i ] . home . gp += 1 ; arr [ i ] . away . gp += 1 ; if ( arr [ i ] . Hscore > arr [ i ] . Ascore ) { arr [ i ] . home . won += 1 ; arr [ i ] . away . lost += 1 ; arr [ i ] . home . points += 3 ; } ; if ( arr [ i ] . Ascore > arr [ i ] . Hscore ) { arr [ i ] . away . won += 1 ; arr [ i ] . home . lost += 1 ; arr [ i ] . away . points += 3 ; } ; if ( arr [ i ] . Hscore == arr [ i ] . Ascore ) { arr [ i ] . home . points += 1 ; arr [ i ] . away . points += 1 ; arr [ i ] . home . drawn += 1 ; arr [ i ] . away . drawn += 1 ; } ; var goalDifferential = ( arr [ i ] . Hscore - arr [ i ] . Ascore ) ; arr [ i ] . home . gf += arr [ i ] . Hscore ; arr [ i ] . home . ga += arr [ i ] . Ascore ; arr [ i ] . home . gd += goalDifferential ; arr [ i ] . away . gf += arr [ i ] . Ascore ; arr [ i ] . away . ga += arr [ i ] . Hscore ; arr [ i ] . away . gd -= goalDifferential ; } ; }
updateTeams translates the schedule into proper statistical data for teams
updateTeams translates the schedule into proper statistical data for teams