From 4bc47bd2b21157ff29a9a0ec7e65d1be42c8f448 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 17 Jul 2014 11:21:25 +0100 Subject: [PATCH] don't search for instituion until we get a few chars. Saves some usless algolia http calls --- services/web/public/coffee/main/user-details.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/web/public/coffee/main/user-details.coffee b/services/web/public/coffee/main/user-details.coffee index 9f781a5a2a..a303086ca7 100644 --- a/services/web/public/coffee/main/user-details.coffee +++ b/services/web/public/coffee/main/user-details.coffee @@ -49,6 +49,10 @@ define [ # listen for blur events on institution field to send the post if inputVal?.indexOf("(") != -1 and inputVal?.indexOf(")") != -1 $scope.sendUpdate() + + query = $scope.userInfoForm.institution + if query?.length <= 3 + return #saves us algolia searches, need ~4 chars to get uni anyway Institutions.search $scope.userInfoForm.institution, (err, response)-> $scope.institutions = _.map response.hits, (institution)->