@measurequick/measurequick-report-generator 1.5.183 → 1.5.184
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
|
@@ -11,6 +11,7 @@ import * as systemInfoPage from "./system-info-page.js";
|
|
|
11
11
|
import * as vitalsCoolingReport from "./vitals-cooling-report.js";
|
|
12
12
|
import * as vitalsHeatingReport from "./vitals-heating-report.js";
|
|
13
13
|
import * as vitalsHeatingReportNoCombustion from "./vitals-heating-report-no-combustion.js";
|
|
14
|
+
import * as vitalsHeatpumpHeatingReport from "./vitals-heatpump-heating-report.js";
|
|
14
15
|
import * as nciReport from "./nci-report.js";
|
|
15
16
|
import * as energyStarCertificate from "./energy-star-certificate.js";
|
|
16
17
|
import * as accaCertificate from "./acca-certificate.js";
|
|
@@ -19,6 +20,31 @@ import * as util from "../util.js";
|
|
|
19
20
|
let docs = [];
|
|
20
21
|
let forms = [];
|
|
21
22
|
|
|
23
|
+
// Helper to check if a test is heat pump heating mode
|
|
24
|
+
function isHeatPumpHeating(test) {
|
|
25
|
+
if (!test || !test.testInfo) return false;
|
|
26
|
+
const mode = test.testInfo.mode;
|
|
27
|
+
const hasHpScore = test.testInfo.data && test.testInfo.data.hp_heating_vitals_score != null;
|
|
28
|
+
return mode === "Heat Pump" || mode === "nist-efficiency-hp" || hasHpScore;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Helper to get the appropriate vitals report for a test
|
|
32
|
+
async function getVitalsReport(payload, test, reportMode) {
|
|
33
|
+
// Check for heat pump heating first
|
|
34
|
+
if (isHeatPumpHeating(test)) {
|
|
35
|
+
return await vitalsHeatpumpHeatingReport.getReport(payload, test);
|
|
36
|
+
}
|
|
37
|
+
// Cooling mode
|
|
38
|
+
if (reportMode === "cooling") {
|
|
39
|
+
return await vitalsCoolingReport.getReport(payload, test);
|
|
40
|
+
}
|
|
41
|
+
// Heating mode (gas furnace)
|
|
42
|
+
if (test && test.gasHeatingHasCombustionAnalyzer === false) {
|
|
43
|
+
return await vitalsHeatingReportNoCombustion.getReport(payload, test);
|
|
44
|
+
}
|
|
45
|
+
return await vitalsHeatingReport.getReport(payload, test);
|
|
46
|
+
}
|
|
47
|
+
|
|
22
48
|
export async function getReport(payload) {
|
|
23
49
|
const coreDoc = await PDFDocument.create();
|
|
24
50
|
|
|
@@ -146,13 +172,8 @@ export async function getReport(payload) {
|
|
|
146
172
|
payload.tests[0].testInfo &&
|
|
147
173
|
payload.tests[0].testInfo.mode !== "efficiency-nist"
|
|
148
174
|
) {
|
|
149
|
-
payload.meta.header = "Test In A/C Vitals";
|
|
150
|
-
let vitalsReportBase64 =
|
|
151
|
-
payload.meta.report_mode == "cooling"
|
|
152
|
-
? await vitalsCoolingReport.getReport(payload)
|
|
153
|
-
: payload.tests[0].gasHeatingHasCombustionAnalyzer === false
|
|
154
|
-
? await vitalsHeatingReportNoCombustion.getReport(payload)
|
|
155
|
-
: await vitalsHeatingReport.getReport(payload);
|
|
175
|
+
payload.meta.header = isHeatPumpHeating(payload.tests[0]) ? "Heat Pump Heating Vitals" : "Test In A/C Vitals";
|
|
176
|
+
let vitalsReportBase64 = await getVitalsReport(payload, payload.tests[0], payload.meta.report_mode);
|
|
156
177
|
const vitalsReportDoc = await PDFDocument.load(
|
|
157
178
|
util._base64ToArrayBuffer(vitalsReportBase64.data)
|
|
158
179
|
);
|
|
@@ -225,16 +246,8 @@ export async function getReport(payload) {
|
|
|
225
246
|
payload.tests[1].testInfo &&
|
|
226
247
|
payload.tests[1].testInfo.mode !== "efficiency-nist"
|
|
227
248
|
) {
|
|
228
|
-
payload.meta.header = "Test Out A/C Vitals";
|
|
229
|
-
let vitalsReportBase64 =
|
|
230
|
-
payload.meta.report_mode == "cooling"
|
|
231
|
-
? await vitalsCoolingReport.getReport(payload, payload.tests[1])
|
|
232
|
-
: payload.tests[1].gasHeatingHasCombustionAnalyzer === false
|
|
233
|
-
? await vitalsHeatingReportNoCombustion.getReport(
|
|
234
|
-
payload,
|
|
235
|
-
payload.tests[1]
|
|
236
|
-
)
|
|
237
|
-
: await vitalsHeatingReport.getReport(payload, payload.tests[1]);
|
|
249
|
+
payload.meta.header = isHeatPumpHeating(payload.tests[1]) ? "Heat Pump Heating Vitals" : "Test Out A/C Vitals";
|
|
250
|
+
let vitalsReportBase64 = await getVitalsReport(payload, payload.tests[1], payload.meta.report_mode);
|
|
238
251
|
const vitalsReportDoc = await PDFDocument.load(
|
|
239
252
|
util._base64ToArrayBuffer(vitalsReportBase64.data)
|
|
240
253
|
);
|