{"action":"created","issue":{"url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/716","repository_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project","labels_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/716/labels{/name}","comments_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/716/comments","events_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/716/events","html_url":"https://github.com/ga-wdi-boston/full-stack-project/issues/716","id":211911596,"number":716,"title":"Getting a message to display with an empty database...","user":{"login":"alexkarasik","id":11474345,"avatar_url":"https://avatars2.githubusercontent.com/u/11474345?v=3","gravatar_id":"","url":"https://api.github.com/users/alexkarasik","html_url":"https://github.com/alexkarasik","followers_url":"https://api.github.com/users/alexkarasik/followers","following_url":"https://api.github.com/users/alexkarasik/following{/other_user}","gists_url":"https://api.github.com/users/alexkarasik/gists{/gist_id}","starred_url":"https://api.github.com/users/alexkarasik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexkarasik/subscriptions","organizations_url":"https://api.github.com/users/alexkarasik/orgs","repos_url":"https://api.github.com/users/alexkarasik/repos","events_url":"https://api.github.com/users/alexkarasik/events{/privacy}","received_events_url":"https://api.github.com/users/alexkarasik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-03-04T22:01:17Z","updated_at":"2017-03-04T22:06:41Z","closed_at":null,"body":"I have been working on getting a message to display when my database is empty and it has not been working... \r\nThis is the event that gets triggered by clicking a \"show movies\" button:\r\n```\r\nconst onGetMovies = function (event) {\r\n  event.preventDefault();\r\n  api.showMovies()\r\n  .then((response) => {\r\n     store.movies = response.movies;\r\n     return store;\r\n   })\r\n  .then(ui.onSuccess)\r\n  .catch(ui.onError);\r\n  };\r\n```\r\nThis is my ui success function:\r\n```\r\nconst onSuccess = function (data) {\r\n\r\n  if (data) {\r\n    console.log(data);\r\n  } \r\n  let showMovies = movieHandlebars({ movies: data.movies});\r\n  $('.movie-results').empty().append(showMovies);\r\n  if (store.movies.length === 0) {\r\n    $('.message').text(\"no movies\");\r\n  }\r\n};\r\n```\r\n\r\nand this is my html section where they get displayed:\r\n```\r\n      <button id=\"show-movies\">Show Movies</button>\r\n          <div class=\"movie-results\"></div>\r\n```\r\n\r\nI think that is all the useful info..."},"comment":{"url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/comments/284188144","html_url":"https://github.com/ga-wdi-boston/full-stack-project/issues/716#issuecomment-284188144","issue_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/716","id":284188144,"user":{"login":"MicFin","id":5384023,"avatar_url":"https://avatars0.githubusercontent.com/u/5384023?v=3","gravatar_id":"","url":"https://api.github.com/users/MicFin","html_url":"https://github.com/MicFin","followers_url":"https://api.github.com/users/MicFin/followers","following_url":"https://api.github.com/users/MicFin/following{/other_user}","gists_url":"https://api.github.com/users/MicFin/gists{/gist_id}","starred_url":"https://api.github.com/users/MicFin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MicFin/subscriptions","organizations_url":"https://api.github.com/users/MicFin/orgs","repos_url":"https://api.github.com/users/MicFin/repos","events_url":"https://api.github.com/users/MicFin/events{/privacy}","received_events_url":"https://api.github.com/users/MicFin/received_events","type":"User","site_admin":false},"created_at":"2017-03-04T22:06:41Z","updated_at":"2017-03-04T22:06:41Z","body":"On this line you are using `data.movies` to reference all of the movies\r\n\r\n```js\r\nlet showMovies = movieHandlebars({ movies: data.movies});\r\n```\r\nYet in your condition you are using `store.movies` to reference all of the movies.\r\n\r\n```js\r\nif (store.movies.length === 0) {\r\n```\r\nWhat is `store.movies` and what is `data.movies`?\r\n\r\nTo add the `no movies` text to the page you are using\r\n```js\r\n $('.message').text(\"no movies\");\r\n```\r\n\r\nIn this case you are adding the string`no movies` as the text of the HTML elements with the `message` class.  But, in your HTML there is no `message` class from what you've shared."}}
{"actor":{"display_login":"MicFin"}}