@resolveio/server-lib 5.2.2 → 5.2.3

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.
@@ -339,7 +339,7 @@ function loadReportBuilderMethods(methodManager) {
339
339
  });
340
340
  divFields = { $addFields: {} };
341
341
  fieldsTotal.filter(function (a) { return a.type === 'sum'; }).forEach(function (total) {
342
- selectedFields.filter(function (a) { return a.fieldType === 'Number'; }).forEach(function (field) {
342
+ selectedFields.filter(function (a) { return a.fieldType === 'Number' || a.leafValueType === 'Count'; }).forEach(function (field) {
343
343
  var multFields = [];
344
344
  if (!field.fieldPath.includes('.$')) {
345
345
  sizes.forEach(function (size) {
@@ -489,7 +489,7 @@ function loadReportBuilderMethods(methodManager) {
489
489
  // Totals
490
490
  if (fieldsTotal.length) {
491
491
  fieldsTotal.forEach(function (total) {
492
- selectedFields.filter(function (a) { return a.fieldType === 'Number'; }).forEach(function (field) {
492
+ selectedFields.filter(function (a) { return a.fieldType === 'Number' || a.leafValueType === 'Count'; }).forEach(function (field) {
493
493
  // queryGroup[total.id + '_' + field.id] = {['$' + total.type]: '$' + total.id + '_' + field.id};
494
494
  queryGroup[total.id + '_' + field.id] = { $sum: '$' + total.id + '_' + field.id };
495
495
  });
@@ -530,7 +530,7 @@ function loadReportBuilderMethods(methodManager) {
530
530
  //Totals
531
531
  if (fieldsTotal.length && (reportType === 'Tabular' || reportType === 'Dated')) {
532
532
  fieldsTotal.forEach(function (total) {
533
- selectedFields.filter(function (a) { return a.fieldType === 'Number'; }).forEach(function (field) {
533
+ selectedFields.filter(function (a) { return a.fieldType === 'Number' || a.leafValueType === 'Count'; }).forEach(function (field) {
534
534
  var _a;
535
535
  queryProjection_1[total.id + '_' + field.id] = (_a = {}, _a['$' + total.type] = '$' + total.id + '_' + field.id, _a);
536
536
  });
@@ -560,7 +560,7 @@ function loadReportBuilderMethods(methodManager) {
560
560
  tmpTotals = {};
561
561
  if (res) {
562
562
  fieldsTotal.forEach(function (totField) {
563
- selectedFields.filter(function (b) { return b.fieldType === 'Number'; }).forEach(function (selField) {
563
+ selectedFields.filter(function (b) { return b.fieldType === 'Number' || b.leafValueType === 'Count'; }).forEach(function (selField) {
564
564
  if (totField.type === 'sum') {
565
565
  tmpTotals[totField.id + '_' + selField.id] = res.map(function (a) { return a[totField.id + '_' + selField.id] || 0; }).reduce(function (a, b) { return a + b; }, 0);
566
566
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "5.2.2",
3
+ "version": "5.2.3",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {