@darkpos/pricing 1.0.14 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -190,8 +190,16 @@ module.exports = ({ actions, itemActions, modifierActions, settings, _ }) => {
190
190
  !_.isEmpty(orderItem.modifiers)
191
191
  )
192
192
  requiredModifiers = getUnselectedModifiers(orderItem, requiredModifiers);
193
- if (!_.isEmpty(requiredModifiers))
194
- modifiersToAdd.push(...requiredModifiers);
193
+ if (!_.isEmpty(requiredModifiers)) {
194
+ modifiersToAdd.push(
195
+ ...requiredModifiers.filter(
196
+ reqMod =>
197
+ !modifiersToAdd.find(
198
+ modToAdd => modToAdd.modifierId === reqMod.modifierId
199
+ )
200
+ )
201
+ );
202
+ }
195
203
 
196
204
  orderItem = actions.getOrderItemSubscriptions({
197
205
  order,
@@ -48,29 +48,29 @@ module.exports = ({
48
48
 
49
49
  const getOrder =
50
50
  ({ order, name }) =>
51
- (items, index) => {
52
- let displayId = '';
53
- if (orderSettings.allowSuborder)
54
- displayId = `${order.displayId}-${index}`;
55
- else if (index === 1) displayId = order.displayId;
56
- return {
57
- ...order,
58
- _id: helpers.getObjectID(),
59
- displayId,
60
- discount: 0,
61
- tax: 0,
62
- parentId: orderSettings.allowSuborder ? order._id : null,
63
- items,
64
- modifiers: [],
65
- notes: [
66
- ...(order.notes || []),
67
- {
68
- ...noteDefaults,
69
- message: `Split from ${order.displayId}, for department ${name}`,
70
- },
71
- ],
72
- };
51
+ (items, index) => {
52
+ let displayId = '';
53
+ if (orderSettings.allowSuborder)
54
+ displayId = `${order.displayId}-${index}`;
55
+ else if (index === 1) displayId = order.displayId;
56
+ return {
57
+ ...order,
58
+ _id: helpers.getObjectID(),
59
+ displayId,
60
+ discount: 0,
61
+ tax: 0,
62
+ parentId: orderSettings.allowSuborder ? order._id : null,
63
+ items,
64
+ modifiers: [],
65
+ notes: [
66
+ ...(order.notes || []),
67
+ {
68
+ ...noteDefaults,
69
+ message: `Split from ${order.displayId}, for department ${name}`,
70
+ },
71
+ ],
73
72
  };
73
+ };
74
74
 
75
75
  const getDepartmentName = item => {
76
76
  const deps = itemActions.getDepartmentModifiers(item);
@@ -108,7 +108,7 @@ module.exports = ({
108
108
  newOrder =>
109
109
  newOrder.items &&
110
110
  itemActions.getItemsTotalPieces(newOrder.items) + totalPieces <=
111
- maxItems &&
111
+ maxItems &&
112
112
  departmentName === getDepartmentName(newOrder.items[0])
113
113
  );
114
114
  if (index > -1) splitOrders[index].items.push(item);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darkpos/pricing",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "Pricing calculator",
5
5
  "author": "Dark POS",
6
6
  "license": "ISC",
@@ -35,5 +35,5 @@
35
35
  "supertest": "^6.2.3",
36
36
  "supervisor": "^0.12.0"
37
37
  },
38
- "gitHead": "67ed395c1d86589b37c5adcb74606a8db7423536"
38
+ "gitHead": "c39fea127ca5bd932ee4828ea463bfafb0083693"
39
39
  }