From 254183bec5b2ae7dd41cb78a0bf000c4cdda4f32 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 22 Oct 2016 18:08:51 -0400 Subject: [PATCH] Added ordering by subscribers when searching --- hourglass/client/profile/profile.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hourglass/client/profile/profile.js b/hourglass/client/profile/profile.js index 44b9876..a1d7a30 100644 --- a/hourglass/client/profile/profile.js +++ b/hourglass/client/profile/profile.js @@ -37,7 +37,7 @@ Template.profile.helpers({ return "Custom"; },*/ classSettings() { // Returns autocomplete array for classes. - var hi = { + return { position: "bottom", limit: 10, rules: [{ @@ -54,7 +54,6 @@ Template.profile.helpers({ } }] }; - return hi; }, schoolComplete() { // Returns autocomplete array for schools. return { @@ -586,11 +585,11 @@ Template.profile.events({ name: item.childNodes[1].childNodes[0].nodeValue, teacher: item.childNodes[3].childNodes[0].nodeValue, hour: item.childNodes[5].childNodes[0].nodeValue, - subscribers: Math.floor(item.childNodes[7].childNodes[0].nodeValue.length / 17), + subscribers: Math.floor(item.childNodes[7].childNodes[0].nodeValue.length.replace(",","") / 17), _id: item.getAttribute("classid") }); - Session.set("autocompleteDivs", divs); } + Session.set("autocompleteDivs", divs.sort(function(a,b){return b.subscribers-a.subscribers})); } catch (err) {} } });