/** Collection of foods being tracked
* @namespace nt.Collections
* @class nt.Collections.NutritionTracker
* @memberof! <global>
* @extends Backbone.Collection */
nt.Collections.NutritionTracker = Backbone.Collection.extend(/** @lends nt.Collections.NutritionTracker# */{
/** Reference to this collection's model. */
model: nt.Models.Nutrition,
/** Save all of the food items in localStorage. */
localStorage: new Backbone.LocalStorage('nutrition-tracker'),
/** Set default tracker date for today */
initialize: function() {
nt.Option.trackerDate = moment(new Date()).format('YYYY-MM-DD');
nt.Option.displayAll = false;
}, // initialize
/** Each food item is sorted by date */
comparator: function( food ) {
return food.get('trackDate');
}, // comparator
/** Returns a group of models with the same date */
getModelsByDate: function() {