{"action":"created","issue":{"url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/130","repository_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project","labels_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/130/labels{/name}","comments_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/130/comments","events_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/130/events","html_url":"https://github.com/ga-wdi-boston/capstone-project/issues/130","id":146402924,"number":130,"title":"Problems with counting items","user":{"login":"Knguyen21","id":16465193,"avatar_url":"https://avatars.githubusercontent.com/u/16465193?v=3","gravatar_id":"","url":"https://api.github.com/users/Knguyen21","html_url":"https://github.com/Knguyen21","followers_url":"https://api.github.com/users/Knguyen21/followers","following_url":"https://api.github.com/users/Knguyen21/following{/other_user}","gists_url":"https://api.github.com/users/Knguyen21/gists{/gist_id}","starred_url":"https://api.github.com/users/Knguyen21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Knguyen21/subscriptions","organizations_url":"https://api.github.com/users/Knguyen21/orgs","repos_url":"https://api.github.com/users/Knguyen21/repos","events_url":"https://api.github.com/users/Knguyen21/events{/privacy}","received_events_url":"https://api.github.com/users/Knguyen21/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-06T18:56:30Z","updated_at":"2016-04-06T22:50:54Z","closed_at":null,"body":"Hi,\r\n\r\nI'm trying to count all the food items that have the disposal attribute with a certain value. I tried using computed properties, but it doesn't count the total number. Can someone help understand how to get the total number of food items that have a certain value?\r\n\r\nfood Model\r\n``` javascript\r\nimport DS from 'ember-data';\r\nimport Ember from 'ember';\r\n\r\n\r\nexport default DS.Model.extend({\r\n  storage: DS.attr('string'),\r\n  disposal: DS.attr('string'),\r\n  category: DS.attr('string'),\r\n  name: DS.attr('string'),\r\n  description: DS.attr('string'),\r\n  purchasedDate: DS.attr('date', {defaultValue: new Date()}),\r\n  expirationDate: DS.attr('date', {defaultValue: new Date()}),\r\n  remindDate: DS.attr('date', {defaultValue: new Date()}),\r\n  counter: 0,\r\n  count: Ember.computed(function(){\r\n    let total= this.get('counter');\r\n    total++;\r\n    let newtotal= this.set('counter', total);\r\n    return newtotal;\r\n\r\n  })\r\n});\r\n```\r\n\r\nfood.disposal.route.js\r\n\r\n``` javascript\r\nimport Ember from 'ember';\r\n\r\nexport default Ember.Route.extend({\r\n  model: function(){\r\n    return {\r\n      food: this.store.findAll('food'),\r\n      \r\n    };\r\n  },\r\n});\r\n```\r\n\r\nfood.disposal.template.hbs\r\n```handlebars\r\n<h3>Ate</h3>\r\n{{#each model.food as |eachFood|}}\r\n  {{ate-snippet food=eachFood}}\r\n{{/each}}\r\n\r\n<h3>Trash</h3>\r\n{{#each model.food as |eachFood|}}\r\n  {{disposal-snippet food=eachFood}}\r\n{{/each}}\r\n\r\n<h3>Donate</h3>\r\n{{#each model.food as |eachFood|}}\r\n  {{donate-snippet food=eachFood}}\r\n{{/each}}\r\n```\r\n\r\nI have nothing in my donate-snippet component.js\r\n\r\ndonate-snippet.template.hbs\r\n```handlebars\r\n{{#if (eq food.disposal \"donate\")}}\r\n    <p> Disposed by {{food.disposal}} </p>\r\n    <p>name: {{food.name}}</p>\r\n    <br>\r\n    {{food.count}}\r\n{{/if}}\r\n```\r\n\r\nrouter.js\r\n``` javascript\r\nimport Ember from 'ember';\r\nimport config from './config/environment';\r\n\r\nconst Router = Ember.Router.extend({\r\n  location: config.locationType,\r\n});\r\n\r\nRouter.map(function () {\r\n  this.route('sign-up');\r\n  this.route('sign-in');\r\n  this.route('change-password');\r\n  this.route('users');\r\n  this.route('foods');\r\n  this.route('food', function() {\r\n    this.route('freezer');\r\n    this.route('fridge');\r\n    this.route('pantry');\r\n    this.route('disposal');\r\n  });\r\n});\r\n\r\nexport default Router;\r\n```\r\n\r\nThis is the result\r\n![screen shot 2016-04-06 at 2 53 40 pm](https://cloud.githubusercontent.com/assets/16465193/14329025/8c47486c-fc07-11e5-88e7-9d530689cab2.png)\r\n\r\n Can someone help understand how to get the total number of food items that have a certain value?\r\nI tried getting the length, but it returned the length the entire foods array. I tried using an if conditional equality statement to count only the food items that has disposal attribute ===\"donate\", but that didn't work either. "},"comment":{"url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/comments/206602873","html_url":"https://github.com/ga-wdi-boston/capstone-project/issues/130#issuecomment-206602873","issue_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/130","id":206602873,"user":{"login":"Knguyen21","id":16465193,"avatar_url":"https://avatars.githubusercontent.com/u/16465193?v=3","gravatar_id":"","url":"https://api.github.com/users/Knguyen21","html_url":"https://github.com/Knguyen21","followers_url":"https://api.github.com/users/Knguyen21/followers","following_url":"https://api.github.com/users/Knguyen21/following{/other_user}","gists_url":"https://api.github.com/users/Knguyen21/gists{/gist_id}","starred_url":"https://api.github.com/users/Knguyen21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Knguyen21/subscriptions","organizations_url":"https://api.github.com/users/Knguyen21/orgs","repos_url":"https://api.github.com/users/Knguyen21/repos","events_url":"https://api.github.com/users/Knguyen21/events{/privacy}","received_events_url":"https://api.github.com/users/Knguyen21/received_events","type":"User","site_admin":false},"created_at":"2016-04-06T22:50:54Z","updated_at":"2016-04-06T22:50:54Z","body":"I would like to show it in the component's template. "}}