From 341d52512458d7a33e27894cf2737a55a6371974 Mon Sep 17 00:00:00 2001 From: Kenny Dits Date: Mon, 14 Jul 2014 21:07:30 +0200 Subject: [PATCH 1/4] Fix Jquery --- app/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/index.html b/app/index.html index e69e850..7398000 100644 --- a/app/index.html +++ b/app/index.html @@ -38,7 +38,7 @@ - + From 4df2c68156d35411b947dbc7e3f959d51cfe289c Mon Sep 17 00:00:00 2001 From: Kenny Dits Date: Mon, 14 Jul 2014 21:07:51 +0200 Subject: [PATCH 2/4] Add Fontawesome --- app/index.html | 1 + bower.json | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/index.html b/app/index.html index 7398000..9b34ceb 100644 --- a/app/index.html +++ b/app/index.html @@ -19,6 +19,7 @@ + diff --git a/bower.json b/bower.json index e507d41..4890e10 100644 --- a/bower.json +++ b/bower.json @@ -14,7 +14,8 @@ "underscore": "~1.5.2", "restangular": "~1.3.1", "angular-ui-router": "~0.2.10", - "d3": "~3.4.8" + "d3": "~3.4.8", + "font-awesome": "~4.1.0" }, "devDependencies": { "angular-mocks": "~1.2.0", From ebab48ad13257fb21d94daa3e4a2c806434ff39f Mon Sep 17 00:00:00 2001 From: Kenny Dits Date: Mon, 14 Jul 2014 21:08:17 +0200 Subject: [PATCH 3/4] Add more stats on game view --- app/scripts/services/babitchStats.js | 44 +++++++++++++++++++++++++ app/views/partial/statsGame.html | 48 ++++++++++++++++++++++++++-- 2 files changed, 90 insertions(+), 2 deletions(-) diff --git a/app/scripts/services/babitchStats.js b/app/scripts/services/babitchStats.js index 1beed07..14e2bec 100644 --- a/app/scripts/services/babitchStats.js +++ b/app/scripts/services/babitchStats.js @@ -355,6 +355,47 @@ angular.module('babitchFrontendApp') } }; + //Set stats for goal position on each games + var _setGameGoalPosition = function(games) { + + if(!games.hasOwnProperty('goalPosition')) { + games.goalPosition = { + 'red': { + 'attack': 0, + 'defense': 0, + 'owngoal': 0 + }, + 'blue': { + 'attack': 0, + 'defense': 0, + 'owngoal': 0 + } + }; + } + + if(!games.hasOwnProperty('goalPlayers')) { + games.goalPlayers = {}; + + ['blueAttack','redAttack','blueDefense','redDefense'].forEach(function(player) { + games.goalPlayers[games[player]] = { + 'attack': 0, + 'defense': 0, + 'owngoal': 0 + }; + }); + } + + games.goals.forEach(function(goal) { + if(!goal.autogoal) { + games.goalPosition[goal.team][goal.position] ++; + games.goalPlayers[goal.player_id][goal.position] ++; + } else { + games.goalPosition[goal.team].owngoal ++; + games.goalPlayers[goal.player_id].owngoal ++; + } + }); + }; + //Add goal and owngoal for team and players var _setStatsGoalOwnGoal = function(goal) { if (goal.autogoal) { @@ -774,6 +815,9 @@ angular.module('babitchFrontendApp') _setStatsBallsPlayed(games); _setStatsGoalOwnGoal(goal); }); + + _setGameGoalPosition(games); + }); //Compute percentage on each player diff --git a/app/views/partial/statsGame.html b/app/views/partial/statsGame.html index 29e17b7..ffe3a68 100644 --- a/app/views/partial/statsGame.html +++ b/app/views/partial/statsGame.html @@ -46,14 +46,58 @@

Game details

- Elo Ranking : {{ games.redEloTeam }} + {{ games.redEloTeam }} ({{ games.redEloWins }})   - Elo Ranking : {{ games.blueEloTeam }} + {{ games.blueEloTeam }} ({{ games.blueEloWins }}) + + + + {{ games.goalPosition.red.attack }}  + {{ games.goalPosition.red.defense }}  + {{ games.goalPosition.red.owngoal }} + +   + + {{ games.goalPosition.blue.attack }}  + {{ games.goalPosition.blue.defense }}  + {{ games.goalPosition.blue.owngoal }} + + + + + {{ stats.playersList[games.redDefense].name }} Goal: + {{ games.goalPlayers[games.redDefense].attack }}  + {{ games.goalPlayers[games.redDefense].defense }}  + {{ games.goalPlayers[games.redDefense].owngoal }} + +   + + {{ stats.playersList[games.blueDefense].name }} Goal: + {{ games.goalPlayers[games.blueDefense].attack }}  + {{ games.goalPlayers[games.blueDefense].defense }}  + {{ games.goalPlayers[games.blueDefense].owngoal }} + + + + + {{ stats.playersList[games.redAttack].name }} Goal: + {{ games.goalPlayers[games.redAttack].attack }}  + {{ games.goalPlayers[games.redAttack].defense }}  + {{ games.goalPlayers[games.redAttack].owngoal }} + +   + + {{ stats.playersList[games.blueAttack].name }} Goal: + {{ games.goalPlayers[games.blueAttack].attack }}  + {{ games.goalPlayers[games.blueAttack].defense }}  + {{ games.goalPlayers[games.blueAttack].owngoal }} + + From d6e80441cd1de6f0537aea4140846b6633ed98cb Mon Sep 17 00:00:00 2001 From: Kenny Dits Date: Mon, 14 Jul 2014 21:19:10 +0200 Subject: [PATCH 4/4] fix jquery back --- app/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/index.html b/app/index.html index 9b34ceb..741f82e 100644 --- a/app/index.html +++ b/app/index.html @@ -39,7 +39,7 @@ - +