diff --git a/app/views/api/tournament.jbuilder b/app/views/api/tournament.jbuilder index 9216cb7..3241efb 100644 --- a/app/views/api/tournament.jbuilder +++ b/app/views/api/tournament.jbuilder @@ -13,6 +13,7 @@ json.cache! ["api_tournament", @tournament] do json.max weight.max json.bracket_size weight.bracket_size json.wrestlers weight.wrestlers do |wrestler| + json.id wrestler.id json.name wrestler.name json.school wrestler.school.name json.original_seed wrestler.original_seed @@ -27,6 +28,8 @@ json.cache! ["api_tournament", @tournament] do json.mats @tournament.mats do |mat| json.name mat.name json.unfinishedMatches mat.unfinishedMatches do |match| + json.w1 = match.w1 + json.w2 = match.w2 json.bout_number match.bout_number json.w1_name match.w1_name json.w2_name match.w2_name @@ -39,5 +42,17 @@ json.cache! ["api_tournament", @tournament] do json.w2_name match.w2_name json.weightClass match.weight.max json.round match.round + json.w1 = match.w1 + json.w2 = match.w2 + end + + json.matches @tournament.matches do |match| + json.bout_number match.bout_number + json.w1_name match.w1_name + json.w2_name match.w2_name + json.weightClass match.weight.max + json.round match.round + json.w1 = match.w1 + json.w2 = match.w2 end end diff --git a/frontend/app/js/controllers/tournament-controller.js b/frontend/app/js/controllers/tournament-controller.js index 147281a..8c09a41 100644 --- a/frontend/app/js/controllers/tournament-controller.js +++ b/frontend/app/js/controllers/tournament-controller.js @@ -1,5 +1,5 @@ 'use strict'; -app.controller("tournamentController", function($scope, tournamentsService, $routeParams) { +app.controller("tournamentController", function($scope, tournamentsService, $routeParams, Wrestler) { $scope.message = "Test message in scope."; // $scope.tournamentData = "test"; @@ -9,4 +9,7 @@ app.controller("tournamentController", function($scope, tournamentsService, $rou $scope.tournament = data; }); + $scope.wrestler = Wrestler; + + }); \ No newline at end of file diff --git a/frontend/app/js/models/wrestler.js b/frontend/app/js/models/wrestler.js new file mode 100644 index 0000000..4f45c5e --- /dev/null +++ b/frontend/app/js/models/wrestler.js @@ -0,0 +1,19 @@ +'use strict'; + +app.factory('Wrestler', function Wrestler(){ + var vm = this; + + + vm.matches = function(matches,wrestler){ + var givenWrestler = wrestler; + + console.log(givenWrestler.id); + return _.filter(matches, function(match){ + return match.w1 == givenWrestler.id || match.w2 == givenWrestler.id; + }); + + + } + + return vm; +}); \ No newline at end of file diff --git a/frontend/app/js/services/tournaments-service.js b/frontend/app/js/services/tournaments-service.js index 9e1083d..0ac1a3f 100644 --- a/frontend/app/js/services/tournaments-service.js +++ b/frontend/app/js/services/tournaments-service.js @@ -31,8 +31,8 @@ function tournamentsService($http){ }; function successResponse(response){ - console.log("success log below"); - console.log(response); + // console.log("success log below"); + // console.log(response); return response.data; } diff --git a/frontend/app/pages/index.us b/frontend/app/pages/index.us index bf9c532..8ed5e16 100644 --- a/frontend/app/pages/index.us +++ b/frontend/app/pages/index.us @@ -10,41 +10,44 @@
-