Take the first name match from the post-filter results to avoid matching off a result the user can't see

This commit is contained in:
Rohan Mitchell
2015-07-09 11:59:50 +10:00
parent 669c9911fe
commit 0ab75fe2ea
5 changed files with 21 additions and 35 deletions

View File

@@ -1,4 +1,4 @@
Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, Enterprises, Search, $document, HashNavigation, FilterSelectorsService, EnterpriseModal, enterpriseMatchesNameQueryFilter, distanceWithinKmFilter) ->
Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, Enterprises, Search, $document, HashNavigation, FilterSelectorsService, EnterpriseModal, enterpriseMatchesNameQueryFilter, distanceWithinKmFilter) ->
$scope.Enterprises = Enterprises
$scope.totalActive = FilterSelectorsService.totalActive
$scope.clearAll = FilterSelectorsService.clearAll
@@ -13,11 +13,15 @@ Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, Enterprises, Search
$scope.$watch "query", (query)->
Enterprises.evaluateQuery query
Enterprises.flagMatching query
Search.search query
$rootScope.$broadcast 'enterprisesChanged'
$scope.distanceMatchesShown = false
$timeout ->
Enterprises.calculateDistance query, $scope.nameMatchesFiltered[0]
$rootScope.$broadcast 'enterprisesChanged'
$rootScope.$on "enterprisesChanged", ->
$scope.filterEnterprises()