@measurequick/measurequick-report-generator 1.5.218 → 1.5.220

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.218",
3
+ "version": "1.5.220",
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;
@@ -301,23 +318,48 @@ export async function getReport(payload, _test) {
301
318
 
302
319
  if (coHigh) {
303
320
  VH_LOG("Setting CO warnings in form fields: COWarning / COWarning2");
304
- // Find the highest severity level
321
+ // Find the highest severity level and the ambient CO reading
305
322
  var highestLevel = "Elevated";
306
- var maxPpm = 0;
323
+ var ambientReading = null;
307
324
  for (var r = 0; r < reasons.length; r++) {
308
- if (reasons[r].value > maxPpm) maxPpm = reasons[r].value;
325
+ if (reasons[r].type === "Ambient") ambientReading = reasons[r];
309
326
  if (reasons[r].level === "Emergency") highestLevel = "Emergency";
310
327
  else if (reasons[r].level === "Dangerous" && highestLevel !== "Emergency") highestLevel = "Dangerous";
311
328
  }
312
329
 
313
- // Build details string showing each elevated reading
314
- var details = reasons.map(function(r) { return r.type + ": " + Math.round(r.value) + " ppm (" + r.level + ")"; }).join(", ");
330
+ // Build warning message focused on ambient CO
331
+ var warningMsg, warningMsg2;
332
+ if (ambientReading) {
333
+ warningMsg = "WARNING: " + ambientReading.level + " Ambient CO Detected: " + Math.round(ambientReading.value) + " ppm\nVentilate the area and investigate source.";
334
+ warningMsg2 = "WARNING: " + ambientReading.level + " Ambient CO Detected: " + Math.round(ambientReading.value) + " ppm. Ventilate the area and investigate source.";
335
+ } else {
336
+ // Fallback if no ambient reading (use first reading)
337
+ var firstReading = reasons[0];
338
+ warningMsg = "WARNING: " + firstReading.level + " " + firstReading.type + " CO Detected: " + Math.round(firstReading.value) + " ppm\nVentilate the area and investigate source.";
339
+ warningMsg2 = "WARNING: " + firstReading.level + " " + firstReading.type + " CO Detected: " + Math.round(firstReading.value) + " ppm. Ventilate the area and investigate source.";
340
+ }
315
341
 
316
- var warningMsg = "WARNING: " + highestLevel + " CO Detected! " + details + "\nVentilate the area and investigate the source.";
317
- var warningMsg2 = "WARNING: " + highestLevel + " CO Detected! " + details + " Ventilate the area and investigate the source.";
342
+ // Set text with color based on severity level
343
+ // Orange for Elevated, Red for Dangerous, Dark Red for Emergency
344
+ var warningColor;
345
+ if (highestLevel === "Emergency") {
346
+ warningColor = rgb(0.72, 0.11, 0.11); // Dark red (#b71c1c)
347
+ } else if (highestLevel === "Dangerous") {
348
+ warningColor = rgb(0.96, 0.26, 0.21); // Red (#f44336)
349
+ } else {
350
+ warningColor = rgb(1, 0.6, 0); // Orange (#ff9800)
351
+ }
318
352
 
319
- safeSetText(form, "COWarning", warningMsg);
320
- safeSetText(form, "COWarning2", warningMsg2);
353
+ try {
354
+ var tf1 = form.getTextField("COWarning");
355
+ tf1.setText(warningMsg);
356
+ tf1.setTextColor(warningColor);
357
+ } catch (e) {}
358
+ try {
359
+ var tf2 = form.getTextField("COWarning2");
360
+ tf2.setText(warningMsg2);
361
+ tf2.setTextColor(warningColor);
362
+ } catch (e) {}
321
363
  } else {
322
364
  VH_LOG("Clearing CO warnings (values within threshold)");
323
365
  // clear warnings if not applicable
@@ -635,21 +677,32 @@ export async function getReport(payload, _test) {
635
677
  if (coValue !== null && !isNaN(coValue)) {
636
678
  icon = getCOIcon(coValue);
637
679
  const stateText = getCOStateText(coValue);
638
- label = "Ambient CO: " + Math.round(coValue) + " ppm" + (stateText ? " (" + stateText + ")" : "") + suffix;
680
+
681
+ // Format label based on CO level
682
+ if (coValue <= 8) {
683
+ // Normal - just show value
684
+ label = "Ambient CO: " + Math.round(coValue) + " ppm" + suffix;
685
+ } else {
686
+ // Elevated/Dangerous/Emergency - show level and "Investigate!"
687
+ label = "CO Ambient " + stateText + " " + Math.round(coValue) + " ppm, Investigate!" + suffix;
688
+ }
639
689
 
640
690
  // Set text color based on CO level
641
- if (coValue >= 36) {
642
- textColor = rgb(1, 0, 0); // Red for Dangerous/Emergency
691
+ // Orange for Elevated, Red for Dangerous, Dark Red for Emergency
692
+ if (coValue >= 70) {
693
+ textColor = rgb(0.72, 0.11, 0.11); // Dark red for Emergency
694
+ } else if (coValue >= 36) {
695
+ textColor = rgb(0.96, 0.26, 0.21); // Red for Dangerous
643
696
  } else if (coValue >= 9) {
644
- textColor = rgb(0.8, 0.4, 0); // Orange for Elevated
697
+ textColor = rgb(1, 0.6, 0); // Orange for Elevated
645
698
  }
646
699
  } else {
647
700
  // No CO value, use pass/fail status
648
701
  const isFail = !(meas === "Pass" || meas === "High" || meas === "Mid" || meas === "Caution");
649
702
  if (isFail) {
650
- label = "CO Ambient High, Investigate Source!" + suffix;
651
- textColor = rgb(1, 0, 0);
652
- icon = iconRangeRed;
703
+ label = "CO Ambient Elevated, Investigate!" + suffix;
704
+ textColor = rgb(1, 0.6, 0); // Orange
705
+ icon = iconRangeYellow;
653
706
  }
654
707
  }
655
708
  }