@7365admin1/core 3.124.3-staging.413 → 3.124.3-staging.414

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.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@7365admin1/core": patch
3
+ ---
4
+
5
+ Dashboards: one definition of "in progress" for work orders. The Open Work Order tile and the Work Order Status chart now both count in-scope work orders created in the period whose current status is In-Progress, so they can no longer disagree.
package/dist/index.js CHANGED
@@ -92093,6 +92093,31 @@ function highSeverityIncidentCount(severities) {
92093
92093
  var SUPPLY_BASIS_LOWEST_QUANTITY = "lowest-quantity";
92094
92094
  var SUPPLY_BASIS_BELOW_ALERT_LEVEL = "below-alert-level";
92095
92095
  var SUPPLY_THRESHOLD_NOT_IN_MODEL = "Supplies do not record a stock threshold, so these are the lowest-quantity items rather than items below a level.";
92096
+ var WORK_ORDER_IN_PROGRESS = [
92097
+ "In-Progress",
92098
+ "in-progress",
92099
+ "In Progress",
92100
+ "in progress"
92101
+ ];
92102
+ function workOrderInProgressStages(periodRange) {
92103
+ return [
92104
+ {
92105
+ $match: {
92106
+ createdAt: periodRange,
92107
+ status: { $in: WORK_ORDER_IN_PROGRESS }
92108
+ }
92109
+ },
92110
+ { $count: "count" }
92111
+ ];
92112
+ }
92113
+ function workOrderStatusBucket(status) {
92114
+ const s = String(status ?? "").toLowerCase().trim().replace(/\s+/g, "-");
92115
+ if (s === "in-progress")
92116
+ return "inProgress";
92117
+ if (s === "completed")
92118
+ return "completed";
92119
+ return "pending";
92120
+ }
92096
92121
 
92097
92122
  // src/repositories/new-dashboard.repo.ts
92098
92123
  var Period = /* @__PURE__ */ ((Period2) => {
@@ -92213,20 +92238,7 @@ function useNewDashboardRepo() {
92213
92238
  { $match: { createdAt: periodRange } },
92214
92239
  { $count: "count" }
92215
92240
  ],
92216
- inProgress: [
92217
- {
92218
- $match: {
92219
- status: "In-Progress",
92220
- statusUpdates: {
92221
- $elemMatch: {
92222
- status: "In-Progress",
92223
- updatedAt: periodRange
92224
- }
92225
- }
92226
- }
92227
- },
92228
- { $count: "count" }
92229
- ]
92241
+ inProgress: workOrderInProgressStages(periodRange)
92230
92242
  }
92231
92243
  }
92232
92244
  ]).toArray(),
@@ -92616,20 +92628,7 @@ function useNewDashboardRepo() {
92616
92628
  { $match: { createdAt: periodRange } },
92617
92629
  { $count: "count" }
92618
92630
  ],
92619
- inProgress: [
92620
- {
92621
- $match: {
92622
- status: "In-Progress",
92623
- statusUpdates: {
92624
- $elemMatch: {
92625
- status: "In-Progress",
92626
- updatedAt: periodRange
92627
- }
92628
- }
92629
- }
92630
- },
92631
- { $count: "count" }
92632
- ]
92631
+ inProgress: workOrderInProgressStages(periodRange)
92633
92632
  }
92634
92633
  }
92635
92634
  ]).toArray(),
@@ -92873,16 +92872,7 @@ function useNewDashboardRepo() {
92873
92872
  completed: 0
92874
92873
  };
92875
92874
  for (const item of workOrderStatusReport || []) {
92876
- const rawStatus = String(item._id || "").toLowerCase().trim();
92877
- if (rawStatus === "to-do" || rawStatus === "for-review") {
92878
- workOrderStatus.pending += item.count || 0;
92879
- } else if (rawStatus === "in-progress") {
92880
- workOrderStatus.inProgress += item.count || 0;
92881
- } else if (rawStatus === "completed") {
92882
- workOrderStatus.completed += item.count || 0;
92883
- } else {
92884
- workOrderStatus.pending += item.count || 0;
92885
- }
92875
+ workOrderStatus[workOrderStatusBucket(item._id)] += item.count || 0;
92886
92876
  }
92887
92877
  const data = {
92888
92878
  openWorkOrder: {
@@ -93037,20 +93027,7 @@ function useNewDashboardRepo() {
93037
93027
  { $match: { createdAt: periodRange } },
93038
93028
  { $count: "count" }
93039
93029
  ],
93040
- inProgress: [
93041
- {
93042
- $match: {
93043
- status: "In-Progress",
93044
- statusUpdates: {
93045
- $elemMatch: {
93046
- status: "In-Progress",
93047
- updatedAt: periodRange
93048
- }
93049
- }
93050
- }
93051
- },
93052
- { $count: "count" }
93053
- ]
93030
+ inProgress: workOrderInProgressStages(periodRange)
93054
93031
  }
93055
93032
  }
93056
93033
  ]).toArray(),