From cf6b943164d91c8aff9bf7a831788d0af0e68eb5 Mon Sep 17 00:00:00 2001 From: AjK Date: Mon, 9 Apr 2018 20:39:47 +0200 Subject: [PATCH 1/2] [Fix] Menu suggestions --- src/db.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/db.js b/src/db.js index 0b05f70..44fb533 100644 --- a/src/db.js +++ b/src/db.js @@ -509,10 +509,10 @@ exports.getMenuSuggestions = (cb) => { for (let j = 0; j < m.firstCourse.items.length; j++) { const fc = m.firstCourse.items[j]; fcs.push(fc.value); - condiments.concat(fc.condiments); + condiments = condiments.concat(fc.condiments); } - scs.concat(m.secondCourse.items); - sideDishes.concat(m.secondCourse.sideDishes); + scs = scs.concat(m.secondCourse.items); + sideDishes = sideDishes.concat(m.secondCourse.sideDishes); } cb(null, { fc: removeDuplicates(fcs), From 28c95ec46068d608d06d373fc5eb75783c53c7c6 Mon Sep 17 00:00:00 2001 From: AjK Date: Mon, 9 Apr 2018 20:54:47 +0200 Subject: [PATCH 2/2] [Fix] Single table mention --- src/telegram/bot.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/telegram/bot.js b/src/telegram/bot.js index 1f2c421..ba52265 100644 --- a/src/telegram/bot.js +++ b/src/telegram/bot.js @@ -250,13 +250,13 @@ bot.mention(['@tables', '@table'], (ctx) => { if (mention == 'table') { //find user table and broadcast the message for (let i = 0; i < orders.length; i++) { - - if (orders[i].owner._id.equals(ctx.session.user._id)) { + let orderOwner = orders[i].owner._id.toString(), + user = ctx.session.user._id.toString(); + if ( orderOwner === user) { userHasOrdered = true; const userTableName = orders[i].table.name; for (let j = 0; j < orders.length; j++) { - if (!orders[j].owner._id.equals(ctx.session.user._id) && - orders[j].table.name == userTableName) { + if (orders[j].table.name == userTableName && orderOwner != user) { bot.telegram.sendMessage(orders[j].owner.telegram.id, message, { parse_mode: "markdown" });