@measurequick/measurequick-report-generator 1.5.159 → 1.5.160

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@measurequick/measurequick-report-generator",
3
- "version": "1.5.159",
3
+ "version": "1.5.160",
4
4
  "description": "Generates PDF documents for various measureQuick applications.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -2,8 +2,21 @@ import { PDFDocument } from "pdf-lib";
2
2
  import * as base64 from "../base-64/icons.js";
3
3
  import * as pdf from "../base-64/mq-vitals-heating.js";
4
4
  import * as systemInfoPage from "./system-info-page.js";
5
+
5
6
  import * as util from "../util.js";
6
7
 
8
+ // Lightweight debug logger for this module
9
+ const __DEBUG_VITALS_HEATING__ = true;
10
+ function VH_LOG(...args) {
11
+ try {
12
+ if (__DEBUG_VITALS_HEATING__) {
13
+ console.log("[VitalsHeatingReport]", ...args);
14
+ }
15
+ } catch (e) {
16
+ // no-op
17
+ }
18
+ }
19
+
7
20
  function safeSetText(form, name, value) {
8
21
  try {
9
22
  if (value === undefined || value === null) value = "";
@@ -206,12 +219,28 @@ export async function getReport(payload, _test) {
206
219
  var coRetRaw = toNum(data && data.co_return);
207
220
  var coSupRaw = toNum(data && data.co_supply);
208
221
 
209
- var coHigh =
210
- (isFinite(coAmbRaw) && coAmbRaw > 9) ||
211
- (isFinite(coRetRaw) && coRetRaw > 9) ||
212
- (isFinite(coSupRaw) && coSupRaw > 9);
222
+ // Debug: log CO inputs and parsed numbers
223
+ VH_LOG("t present:", !!t, "t.data present:", !!(t && t.data));
224
+ VH_LOG("CO (raw values)", {
225
+ co_ambient: data ? data.co_ambient : undefined,
226
+ co_return: data ? data.co_return : undefined,
227
+ co_supply: data ? data.co_supply : undefined,
228
+ });
229
+ VH_LOG("CO (parsed numbers)", {
230
+ coAmbRaw,
231
+ coRetRaw,
232
+ coSupRaw,
233
+ });
234
+
235
+ var reasons = [];
236
+ if (isFinite(coAmbRaw) && coAmbRaw > 9) reasons.push("ambient=" + coAmbRaw);
237
+ if (isFinite(coRetRaw) && coRetRaw > 9) reasons.push("return=" + coRetRaw);
238
+ if (isFinite(coSupRaw) && coSupRaw > 9) reasons.push("supply=" + coSupRaw);
239
+ var coHigh = reasons.length > 0;
240
+ VH_LOG("CO threshold check > 9 ppm:", { coHigh, reasons });
213
241
 
214
242
  if (coHigh) {
243
+ VH_LOG("Setting CO warnings in form fields: COWarning / COWarning2");
215
244
  safeSetText(
216
245
  form,
217
246
  "COWarning",
@@ -223,6 +252,7 @@ export async function getReport(payload, _test) {
223
252
  "WARNING: Elevated CO above 9 ppm Detected! Ventilate the area and investigate the source."
224
253
  );
225
254
  } else {
255
+ VH_LOG("Clearing CO warnings (values within threshold)");
226
256
  // clear warnings if not applicable
227
257
  safeSetText(form, "COWarning", "");
228
258
  safeSetText(form, "COWarning2", "");
@@ -577,7 +607,7 @@ function getTextFields(payload, test) {
577
607
  test.data.pressure_manifold_before
578
608
  );
579
609
 
580
- return {
610
+ const __textFields = {
581
611
  cName:
582
612
  payload.site.customer.first_name && payload.site.customer.last_name
583
613
  ? `${payload.site.customer.first_name} ${payload.site.customer.last_name}`
@@ -611,4 +641,6 @@ function getTextFields(payload, test) {
611
641
  co_return: fmt(test.data.co_return, 0),
612
642
  co_supply: fmt(test.data.co_supply, 0),
613
643
  };
644
+ VH_LOG("Computed textFields", __textFields);
645
+ return __textFields;
614
646
  }