From dab6ad39c4b995f6ac511629a884df81d2084914 Mon Sep 17 00:00:00 2001 From: sharepointalex Date: Fri, 28 Oct 2016 20:27:35 +0100 Subject: [PATCH] Utils fixes Forgot to check these in - oops! --- .gitignore | 1 + lib/utils.js | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index babf4c3..17aa83e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ deploy.env lambda.zip node_modules/ +.env diff --git a/lib/utils.js b/lib/utils.js index 272828e..26ecbf5 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -17,8 +17,9 @@ function buildPrompt(movies) { return promptData; } -function sendSearchResponse(movies, resp) { - if(!movies || !movies.length) { +function sendSearchResponse(movies, movieName, resp) { + + if(!movies || !movies.length > 0) { return resp.say('No movie found for ' + movieName).send(); } @@ -31,25 +32,23 @@ function sendSearchResponse(movies, resp) { function formatSearchResults(movies) { + var newMovies = []; + console.log(movies); + if (movies != undefined) { - var newMovies = []; - for (var i = 0; i < movies.length; i++) { newMovies.push({ original_title: movies[i].original_title, - inLibrary: isInLibrary(movies[i].in_library), + inLibrary: movies[i].in_library, year: movies[i].year, titles: movies[i].titles, imdb: movies[i].imdb - }); - - } - - + }); + } } - + return newMovies; }