@7365admin1/core 3.102.0 → 3.102.1

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@7365admin1/core",
3
3
  "license": "MIT",
4
- "version": "3.102.0",
4
+ "version": "3.102.1",
5
5
  "author": "7365admin1",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -0,0 +1,54 @@
1
+ // A deleted work order is not open.
2
+ //
3
+ // `work-order.repo.ts` deletes a `work-orders2` row by writing
4
+ // `status: "deleted"` (lower case). The dashboard filters listed only
5
+ // "Deleted", so a deleted work order still counted on the Open Work Order
6
+ // tile, its trend, the activity chart, and as "pending" in the Work Order
7
+ // Status bar. The Work Orders module itself hides it.
8
+ import { after, before, describe, it } from "node:test";
9
+ import assert from "node:assert/strict";
10
+ import { ObjectId } from "mongodb";
11
+
12
+ import { startHarness } from "./harness.mjs";
13
+
14
+ describe("dashboard work order counts skip deleted work orders", { concurrency: 1 }, () => {
15
+ let h;
16
+ const site = new ObjectId();
17
+
18
+ before(async () => {
19
+ h = await startHarness();
20
+ const now = new Date();
21
+ const row = (status, service = "Security") => ({ site, service, status, subject: status, createdAt: now, statusUpdates: [] });
22
+ await h.db.collection("work-orders2").insertMany([
23
+ row("To-Do"),
24
+ row("For Review"),
25
+ row("Completed"),
26
+ row("deleted"),
27
+ row("Deleted"),
28
+ row("To-Do", "Cleaning"),
29
+ row("deleted", "Cleaning"),
30
+ ]);
31
+ });
32
+
33
+ after(async () => {
34
+ await h?.stop();
35
+ });
36
+
37
+ const repo = () => h.core.useNewDashboardRepo();
38
+
39
+ it("Property Management: open = every service's not-completed, not-deleted rows", async () => {
40
+ const d = await repo().getPropertyManagementDashboard(String(site), "today");
41
+ assert.equal(d.openWorkOrder.count, 3);
42
+ assert.deepEqual(d.workOrderStatus, { pending: 3, inProgress: 0, completed: 1 });
43
+ });
44
+
45
+ it("Security: only its own service, deleted rows excluded", async () => {
46
+ const d = await repo().getSecurityDashboard({ siteId: String(site), period: "today" });
47
+ assert.equal(d.openWorkOrder.count, 2);
48
+ });
49
+
50
+ it("a service app (Cleaning): deleted rows excluded", async () => {
51
+ const d = await repo().getServiceDashboard({ site, serviceType: "cleaning_services", period: "today" });
52
+ assert.equal(d.openWorkOrder.count, 1);
53
+ });
54
+ });