Fixing the menu items to sort by date.

This commit is contained in:
Brian McGonagill 2022-09-07 11:30:38 -05:00
parent 2d9ab70fa6
commit 301c66eeba
2 changed files with 3 additions and 1 deletions

View file

@ -12,7 +12,7 @@ Template.menuItemsTbl.onRendered(function() {
Template.menuItemsTbl.helpers({ Template.menuItemsTbl.helpers({
thisMenuItems: function() { thisMenuItems: function() {
return MenuItems.find({}); return MenuItems.find({}, { sort: { serveDateActual: 1 }});
} }
}); });

View file

@ -21,10 +21,12 @@ Meteor.methods({
throw new Meteor.Error('You are not allowed to add items. Make sure you are logged in with valid user credentials.'); throw new Meteor.Error('You are not allowed to add items. Make sure you are logged in with valid user credentials.');
} }
serveDateActual = new Date(serveDate);
return MenuItems.insert({ return MenuItems.insert({
itemName: itemName, itemName: itemName,
serveDate: serveDate, serveDate: serveDate,
serveDateActual: serveDateActual,
menuId: menuId, menuId: menuId,
addedBy: this.userId, addedBy: this.userId,
itemMade: false, itemMade: false,