@measurequick/measurequick-report-generator 1.5.217 → 1.5.219

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.217",
3
+ "version": "1.5.219",
4
4
  "description": "Generates PDF documents for various measureQuick applications.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -244,6 +244,23 @@ export async function getReport(payload, _test) {
244
244
  safeSetText(form, "TimeOfServiceUpper", date.toLocaleTimeString("en-US"));
245
245
  }
246
246
 
247
+ // Build equipment info and set "Information Text" field with shortened description
248
+ const equipment = payload.equipment || {};
249
+ let equipmentLines = [];
250
+ // Try furnace/air handler fields first, then fall back to condenser fields
251
+ const make = equipment.ah_make || equipment.furnace_make || equipment.condenser_make;
252
+ const model = equipment.ah_model || equipment.furnace_model || equipment.condenser_model;
253
+ const serial = equipment.ah_serial || equipment.furnace_serial || equipment.condenser_serial;
254
+ if (make) equipmentLines.push("Make: " + make);
255
+ if (model) equipmentLines.push("Model: " + model);
256
+ if (serial) equipmentLines.push("Serial: " + serial);
257
+
258
+ let infoText = "What Are Your System Vitals?\nYour system vitals show the overall health of your heating system. These vitals account for both the combustion and air delivery of the system.";
259
+ if (equipmentLines.length > 0) {
260
+ infoText = equipmentLines.join("\n") + "\n\n" + infoText;
261
+ }
262
+ safeSetText(form, "Information Text", infoText);
263
+
247
264
  let systemScorePercentage = test.testInfo.data.vitals_score
248
265
  ? +test.testInfo.data.vitals_score.toFixed(0)
249
266
  : 0;
@@ -283,25 +300,41 @@ export async function getReport(payload, _test) {
283
300
  coSupRaw,
284
301
  });
285
302
 
303
+ // CO level helper function
304
+ // Normal: 0-8 ppm, Elevated: 9-35 ppm, Dangerous: 36-69 ppm, Emergency: 70+ ppm
305
+ function getCOLevel(ppm) {
306
+ if (!isFinite(ppm) || ppm <= 8) return "Normal";
307
+ if (ppm >= 9 && ppm <= 35) return "Elevated";
308
+ if (ppm >= 36 && ppm <= 69) return "Dangerous";
309
+ return "Emergency";
310
+ }
311
+
286
312
  var reasons = [];
287
- if (isFinite(coAmbRaw) && coAmbRaw > 9) reasons.push("ambient=" + coAmbRaw);
288
- if (isFinite(coRetRaw) && coRetRaw > 9) reasons.push("return=" + coRetRaw);
289
- if (isFinite(coSupRaw) && coSupRaw > 9) reasons.push("supply=" + coSupRaw);
313
+ if (isFinite(coAmbRaw) && coAmbRaw > 8) reasons.push({ type: "Ambient", value: coAmbRaw, level: getCOLevel(coAmbRaw) });
314
+ if (isFinite(coRetRaw) && coRetRaw > 8) reasons.push({ type: "Return", value: coRetRaw, level: getCOLevel(coRetRaw) });
315
+ if (isFinite(coSupRaw) && coSupRaw > 8) reasons.push({ type: "Supply", value: coSupRaw, level: getCOLevel(coSupRaw) });
290
316
  var coHigh = reasons.length > 0;
291
- VH_LOG("CO threshold check > 9 ppm:", { coHigh, reasons });
317
+ VH_LOG("CO threshold check > 8 ppm:", { coHigh, reasons });
292
318
 
293
319
  if (coHigh) {
294
320
  VH_LOG("Setting CO warnings in form fields: COWarning / COWarning2");
295
- safeSetText(
296
- form,
297
- "COWarning",
298
- "WARNING: Elevated CO above 9 ppm Detected!\nVentilate the area and investigate the source."
299
- );
300
- safeSetText(
301
- form,
302
- "COWarning2",
303
- "WARNING: Elevated CO above 9 ppm Detected! Ventilate the area and investigate the source."
304
- );
321
+ // Find the highest severity level
322
+ var highestLevel = "Elevated";
323
+ var maxPpm = 0;
324
+ for (var r = 0; r < reasons.length; r++) {
325
+ if (reasons[r].value > maxPpm) maxPpm = reasons[r].value;
326
+ if (reasons[r].level === "Emergency") highestLevel = "Emergency";
327
+ else if (reasons[r].level === "Dangerous" && highestLevel !== "Emergency") highestLevel = "Dangerous";
328
+ }
329
+
330
+ // Build details string showing each elevated reading
331
+ var details = reasons.map(function(r) { return r.type + ": " + Math.round(r.value) + " ppm (" + r.level + ")"; }).join(", ");
332
+
333
+ var warningMsg = "WARNING: " + highestLevel + " CO Detected! " + details + "\nVentilate the area and investigate the source.";
334
+ var warningMsg2 = "WARNING: " + highestLevel + " CO Detected! " + details + " Ventilate the area and investigate the source.";
335
+
336
+ safeSetText(form, "COWarning", warningMsg);
337
+ safeSetText(form, "COWarning2", warningMsg2);
305
338
  } else {
306
339
  VH_LOG("Clearing CO warnings (values within threshold)");
307
340
  // clear warnings if not applicable