@softwear/latestcollectioncore 1.0.97 → 1.0.99

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.
@@ -1,3 +1,4 @@
1
+ import { compileExpression } from 'filtrex';
1
2
  import { TransactionI, RaGI, HrTimeframeI, TimeGranularityE, SkuI } from './types';
2
3
  /**
3
4
  * The propFunction for FiltreX needs some data that can't be passed as parameters. That's why the 'globalsRelations' variable is needed.
@@ -28,6 +29,7 @@ declare const _default: {
28
29
  postAgg: typeof postAgg;
29
30
  runQuery: typeof runQuery;
30
31
  whichShardsToProcess: typeof whichShardsToProcess;
32
+ compileExpression: typeof compileExpression;
31
33
  AMOUNT_CHANGE: number;
32
34
  AMOUNT_CONSIGNMENT: number;
33
35
  AMOUNT_END_SHELF_STOCK: number;
@@ -276,6 +276,9 @@ function postAgg(v, timeFrame) {
276
276
  v[MARGIN] = (v[PROFIT] / totalAmountSold) * 100;
277
277
  v[RETURN_PERCENTAGE] = (v[QTY_RETURN] / v[QTY_RECIEVED]) * 100;
278
278
  v[QTY_SOLD_BEFORE_RETURNS] = v[QTY_SOLD] + Math.abs(v[QTY_RETURN]);
279
+ v[QTY_SOLD] = totalQtySold;
280
+ v[AMOUNT_SOLD_EXCL] = totalAmountSold;
281
+ v[COSTPRICE_SOLD] = totalCostSold;
279
282
  }
280
283
  function getTimeGrouper(groupers) {
281
284
  if (groupers.includes('transaction.year'))
@@ -380,6 +383,7 @@ exports.default = {
380
383
  postAgg,
381
384
  runQuery,
382
385
  whichShardsToProcess,
386
+ compileExpression: filtrex_1.compileExpression,
383
387
  AMOUNT_CHANGE,
384
388
  AMOUNT_CONSIGNMENT,
385
389
  AMOUNT_END_SHELF_STOCK,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwear/latestcollectioncore",
3
- "version": "1.0.97",
3
+ "version": "1.0.99",
4
4
  "description": "Core functions for LatestCollections applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,6 +29,6 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "date-fns": "^2.29.3",
32
- "filtrex": "^3.0.0"
32
+ "filtrex": "^3.1.0"
33
33
  }
34
34
  }
@@ -342,6 +342,9 @@ function postAgg(v: any, timeFrame: number): void {
342
342
  v[MARGIN] = (v[PROFIT] / totalAmountSold) * 100
343
343
  v[RETURN_PERCENTAGE] = (v[QTY_RETURN] / v[QTY_RECIEVED]) * 100
344
344
  v[QTY_SOLD_BEFORE_RETURNS] = v[QTY_SOLD] + Math.abs(v[QTY_RETURN])
345
+ v[QTY_SOLD] = totalQtySold
346
+ v[AMOUNT_SOLD_EXCL] = totalAmountSold
347
+ v[COSTPRICE_SOLD] = totalCostSold
345
348
  }
346
349
 
347
350
  function getTimeGrouper(groupers: string[]): TimeGranularityE | undefined {
@@ -452,6 +455,7 @@ export default {
452
455
  postAgg,
453
456
  runQuery,
454
457
  whichShardsToProcess,
458
+ compileExpression,
455
459
  AMOUNT_CHANGE,
456
460
  AMOUNT_CONSIGNMENT,
457
461
  AMOUNT_END_SHELF_STOCK,
@@ -194,6 +194,9 @@ describe('#articleStatus', () => {
194
194
  expect(JSON.stringify(result[2].vector[articleStatus.QTY_AVG_STOCK])).to.equal('8.000000063419584')
195
195
  expect(JSON.stringify(result[2].vector[articleStatus.VALUE_AVG_STOCK])).to.equal('80.00000063419584')
196
196
  expect(JSON.stringify(result[2].vector[articleStatus.MARGIN])).to.equal('50')
197
+ expect(JSON.stringify(result[2].vector[articleStatus.QTY_SOLD])).to.equal('2')
198
+ expect(JSON.stringify(result[2].vector[articleStatus.AMOUNT_SOLD_EXCL])).to.equal('40')
199
+ expect(JSON.stringify(result[2].vector[articleStatus.COSTPRICE_SOLD])).to.equal('20')
197
200
  })
198
201
 
199
202
  it('should calculate aggregations', () => {