Skip to content

Commit

Permalink
update: change order splitting method (now by needsPreparation)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuturd committed Mar 18, 2024
1 parent 61a49ab commit de4b4d9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/controllers/order/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const create = async (req: BodyRequest<Body>, res: Response) => {
})
.reduce(
(acc, item) => {
if (item.item.category.key !== 'pizzas') {
if (item.item.category.needsPreparation === true) {
acc[0].push(item);
} else {
acc[1].push(item);
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/order/dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const dispatch = async (req: BodyRequest<BuckResponse>, res: Response<unknown, O

const separatedItems = items.reduce(
(acc, item) => {
acc[Number(item.category.key === 'pizzas')].push(item);
acc[Number(item.category.needsPreparation === false)].push(item);
return acc;
},
[[], []] as [Partial<Item>[], Partial<Item>[]],
Expand Down

0 comments on commit de4b4d9

Please sign in to comment.