@measurequick/measurequick-report-generator 1.5.207 → 1.5.208

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.207",
3
+ "version": "1.5.208",
4
4
  "description": "Generates PDF documents for various measureQuick applications.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,6 +15,7 @@ import * as vitalsHeatpumpHeatingReport from "./vitals-heatpump-heating-report.j
15
15
  import * as nciReport from "./nci-report.js";
16
16
  import * as energyStarCertificate from "./energy-star-certificate.js";
17
17
  import * as accaCertificate from "./acca-certificate.js";
18
+ import * as notesSummaryPage from "./notes-summary-page.js";
18
19
  import * as util from "../util.js";
19
20
 
20
21
  let docs = [];
@@ -487,6 +488,13 @@ export async function getReport(payload) {
487
488
  errors.push(`System Info: ${error}`);
488
489
  }
489
490
 
491
+ /******** AI SUMMARY / NOTES (1+ PAGES) *********/
492
+ try {
493
+ await notesSummaryPage.addNotesSummaryPages(coreDoc, payload);
494
+ } catch (error) {
495
+ errors.push(`AI Summary: ${error}`);
496
+ }
497
+
490
498
  return errors.length > 0
491
499
  ? { status: 400, data: errors.join("\n") }
492
500
  : { status: 200, data: await coreDoc.saveAsBase64({ dataUri: true }) };
package/util.js CHANGED
@@ -293,99 +293,104 @@ export function getElectricalData(test, suffix, embeddedIcons) {
293
293
  if (phase === "Single") {
294
294
  if (
295
295
  (voltage == "115" || voltage == "120") &&
296
- test.data[`voltage_l1`] &&
297
- test.data[`amperage_l1`]
296
+ test.data[`voltage_l1${suffix}`] &&
297
+ test.data[`amperage_l1${suffix}`]
298
298
  ) {
299
- vDisplay = (+test.data[`voltage_l1`]).toFixed(1);
300
- aDisplay = (+test.data[`amperage_l1`]).toFixed(1);
299
+ vDisplay = (+test.data[`voltage_l1${suffix}`]).toFixed(1);
300
+ aDisplay = (+test.data[`amperage_l1${suffix}`]).toFixed(1);
301
301
  } else if (
302
302
  (voltage == "115" || voltage == "120") &&
303
- test.data[`voltage_l1_ph_to_gnd`] &&
304
- test.data[`amperage_l1_ph_to_gnd`]
303
+ test.data[`voltage_l1${suffix}_ph_to_gnd`] &&
304
+ test.data[`amperage_l1${suffix}_ph_to_gnd`]
305
305
  ) {
306
- vDisplay = (+test.data[`voltage_l1_ph_to_gnd`]).toFixed(1);
307
- aDisplay = (+test.data[`amperage_l1_ph_to_gnd`]).toFixed(1);
308
- src = "_l1_ph_to_gnd";
306
+ vDisplay = (+test.data[`voltage_l1${suffix}_ph_to_gnd`]).toFixed(1);
307
+ aDisplay = (+test.data[`amperage_l1${suffix}_ph_to_gnd`]).toFixed(1);
308
+ src = `_l1${suffix}_ph_to_gnd`;
309
309
  } else if (
310
310
  (voltage == "208" ||
311
311
  voltage == "230" ||
312
312
  voltage == "240" ||
313
313
  voltage == "460" ||
314
314
  voltage == "480") &&
315
- test.data[`voltage_l1`] &&
316
- test.data[`amperage_l1`]
315
+ test.data[`voltage_l1${suffix}`] &&
316
+ test.data[`amperage_l1${suffix}`]
317
317
  ) {
318
- vDisplay = (+test.data[`voltage_l1`]).toFixed(1);
319
- aDisplay = (+test.data[`amperage_l1`]).toFixed(1);
318
+ vDisplay = (+test.data[`voltage_l1${suffix}`]).toFixed(1);
319
+ aDisplay = (+test.data[`amperage_l1${suffix}`]).toFixed(1);
320
320
  } else if (
321
321
  (voltage == "208" ||
322
322
  voltage == "230" ||
323
323
  voltage == "240" ||
324
324
  voltage == "460" ||
325
325
  voltage == "480") &&
326
- test.data[`voltage_l1_ph_to_gnd`] &&
327
- test.data[`voltage_l2_ph_to_gnd`] &&
328
- test.data[`amperage_l1_ph_to_gnd`] &&
329
- test.data[`amperage_l2_ph_to_gnd`]
326
+ test.data[`voltage_l1${suffix}_ph_to_gnd`] &&
327
+ test.data[`voltage_l2${suffix}_ph_to_gnd`] &&
328
+ test.data[`amperage_l1${suffix}_ph_to_gnd`] &&
329
+ test.data[`amperage_l2${suffix}_ph_to_gnd`]
330
330
  ) {
331
331
  vDisplay =
332
- (+test.data[`voltage_l1_ph_to_gnd`]).toFixed(1) +
332
+ (+test.data[`voltage_l1${suffix}_ph_to_gnd`]).toFixed(1) +
333
333
  " / " +
334
- (+test.data[`voltage_l2_ph_to_gnd`]).toFixed(1);
334
+ (+test.data[`voltage_l2${suffix}_ph_to_gnd`]).toFixed(1);
335
335
  aDisplay =
336
- (+test.data[`amperage_l1_ph_to_gnd`]).toFixed(1) +
336
+ (+test.data[`amperage_l1${suffix}_ph_to_gnd`]).toFixed(1) +
337
337
  " / " +
338
- (+test.data[`amperage_l2_ph_to_gnd`]).toFixed(1);
339
- src = "_l1_ph_to_gnd";
338
+ (+test.data[`amperage_l2${suffix}_ph_to_gnd`]).toFixed(1);
339
+ src = `_l1${suffix}_ph_to_gnd`;
340
340
  }
341
341
  } else if (
342
342
  phase === "Three" &&
343
- test.data[`voltage_l1`] &&
344
- test.data.voltage_l2 &&
345
- test.data[`voltage_l3`] &&
346
- test.data[`amperage_l1`] &&
347
- test.data.amperage_l2 &&
348
- test.data[`amperage_l3`]
343
+ test.data[`voltage_l1${suffix}`] &&
344
+ test.data[`voltage_l2${suffix}`] &&
345
+ test.data[`voltage_l3${suffix}`] &&
346
+ test.data[`amperage_l1${suffix}`] &&
347
+ test.data[`amperage_l2${suffix}`] &&
348
+ test.data[`amperage_l3${suffix}`]
349
349
  ) {
350
350
  vDisplay =
351
- (+test.data[`voltage_l1`]).toFixed(1) +
351
+ (+test.data[`voltage_l1${suffix}`]).toFixed(1) +
352
352
  " / " +
353
- (+test.data[`voltage_l2`]).toFixed(1) +
353
+ (+test.data[`voltage_l2${suffix}`]).toFixed(1) +
354
354
  " / " +
355
- (+test.data[`voltage_l3`]).toFixed(1);
355
+ (+test.data[`voltage_l3${suffix}`]).toFixed(1);
356
356
  aDisplay =
357
- (+test.data[`amperage_l1`]).toFixed(1) +
357
+ (+test.data[`amperage_l1${suffix}`]).toFixed(1) +
358
358
  " / " +
359
- (+test.data[`amperage_l2`]).toFixed(1) +
359
+ (+test.data[`amperage_l2${suffix}`]).toFixed(1) +
360
360
  " / " +
361
- (+test.data[`amperage_l3`]).toFixed(1);
361
+ (+test.data[`amperage_l3${suffix}`]).toFixed(1);
362
362
  }
363
363
  } else if (test.electrical_capture_type === "Power") {
364
364
  vDisplay = (+test.data[`voltage_l1`]).toFixed(1);
365
365
  aDisplay = (+test.data[`amperage_l1`]).toFixed(1);
366
366
  }
367
+ // Build the source key with suffix for AHU support
368
+ // Note: for ph_to_gnd cases, src already includes the suffix, so don't add it again
369
+ const suffixAlreadyInSrc = src.includes(suffix) && suffix !== "";
370
+ const vSourceKey = suffixAlreadyInSrc ? "voltage" + src : "voltage" + src + suffix;
371
+ const aSourceKey = suffixAlreadyInSrc ? "amperage" + src : "amperage" + src + suffix;
367
372
  if (vDisplay) {
368
- if (test.source["voltage" + src] == "ComfortGuard")
373
+ if (test.source[vSourceKey] == "ComfortGuard")
369
374
  vIcon = embeddedIcons.iconSensi;
370
- else if (test.source["voltage" + src] == "iDVM550" || test.source["voltage" + src] == "iDVM-550")
375
+ else if (test.source[vSourceKey] == "iDVM550" || test.source[vSourceKey] == "iDVM-550")
371
376
  vIcon = embeddedIcons.iconRedfish550;
372
- else if (test.source["voltage" + src] == "VOLT-100")
377
+ else if (test.source[vSourceKey] == "VOLT-100")
373
378
  vIcon = embeddedIcons.iconVolt100;
374
- else if (test.source["voltage" + src] == "iDVM510")
379
+ else if (test.source[vSourceKey] == "iDVM510")
375
380
  vIcon = embeddedIcons.iconRedfish510;
376
- else if (test.source["voltage" + src] == "Fieldpiece")
381
+ else if (test.source[vSourceKey] == "Fieldpiece")
377
382
  vIcon = embeddedIcons.iconFieldpiece;
378
383
  }
379
384
  if (aDisplay) {
380
- if (test.source["amperage" + src] == "ComfortGuard")
385
+ if (test.source[aSourceKey] == "ComfortGuard")
381
386
  aIcon = embeddedIcons.iconSensi;
382
- else if (test.source["amperage" + src] == "iDVM550" || test.source["amperage" + src] == "iDVM-550")
387
+ else if (test.source[aSourceKey] == "iDVM550" || test.source[aSourceKey] == "iDVM-550")
383
388
  aIcon = embeddedIcons.iconRedfish550;
384
- else if (test.source["amperage" + src] == "VOLT-100")
389
+ else if (test.source[aSourceKey] == "VOLT-100")
385
390
  aIcon = embeddedIcons.iconVolt100;
386
- else if (test.source["amperage" + src] == "iDVM510")
391
+ else if (test.source[aSourceKey] == "iDVM510")
387
392
  aIcon = embeddedIcons.iconRedfish510;
388
- else if (test.source["amperage" + src] == "Fieldpiece")
393
+ else if (test.source[aSourceKey] == "Fieldpiece")
389
394
  aIcon = embeddedIcons.iconFieldpiece;
390
395
  }
391
396
  return {