Skip to content

Commit

Permalink
#44 #50 #7 #3 #9 Display results of multiple filters on the dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
thegsi committed Jan 8, 2016
1 parent 76902ad commit ca2f912
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions lib/societydashboardsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ var client = require('./redis.js');

exports.register = function (server, options, next) {

var template = require('./dashboardhandlebars.js');

server.route([
{
method: 'POST',
Expand All @@ -17,8 +19,9 @@ exports.register = function (server, options, next) {
description: 'return home page',
handler: function(request,reply){
var requestPayload = request.payload;
var arrayOfFilters = [];
var arrayOfFilters = ['type:society'];
var requestPayloadKeys = Object.keys(requestPayload);
var object = [];

var arrayOfSetNames = function(requestPayload,requestPayloadKeys){
requestPayloadKeys.forEach(function(elem){
Expand All @@ -29,12 +32,28 @@ exports.register = function (server, options, next) {
});
};

var callback = function(){

var quoteData = {
object:object
};
var quote = template.buildQuote(quoteData);
return reply(quote);
};

arrayOfSetNames(requestPayload,requestPayloadKeys);
client.sinterAsync.apply(client, arrayOfFilters)
.then(function(filteredlist){
console.log(filteredlist);
.each(function(membersArray){
return client.hgetallAsync(membersArray)
.then(function(hgetallobject){
object.push(hgetallobject);
});
})
.then(function(){
// client.unref();
callback();
});
return reply('You have searched');
// return reply('You have searched');


}
Expand Down

0 comments on commit ca2f912

Please sign in to comment.