@measurequick/measurequick-report-generator 1.5.191 → 1.5.193
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
|
@@ -39,7 +39,7 @@ export async function getReport(payload, options = {}) {
|
|
|
39
39
|
let companyImage = null;
|
|
40
40
|
let companyImageType = null;
|
|
41
41
|
try {
|
|
42
|
-
companyImageType = util.checkCompanyLogo
|
|
42
|
+
companyImageType = util.checkCompanyLogo ? util.checkCompanyLogo(payload.meta) : null;
|
|
43
43
|
} catch (e) {}
|
|
44
44
|
if (companyImageType === "jpg") {
|
|
45
45
|
companyImage = await pdfDoc.embedJpg(
|
|
@@ -55,7 +55,7 @@ export async function getReport(payload, options = {}) {
|
|
|
55
55
|
let profileImage = null;
|
|
56
56
|
let profileImageType = null;
|
|
57
57
|
try {
|
|
58
|
-
profileImageType = util.checkProfilePicture
|
|
58
|
+
profileImageType = util.checkProfilePicture ? util.checkProfilePicture(payload.meta) : null;
|
|
59
59
|
} catch (e) {}
|
|
60
60
|
if (profileImageType) {
|
|
61
61
|
let profilePicBase64;
|
|
@@ -89,7 +89,7 @@ export async function getReport(payload, options = {}) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
// Set tech name
|
|
92
|
-
if (payload.meta.profile_settings
|
|
92
|
+
if ((payload.meta.profile_settings && payload.meta.profile_settings.techFirstName) || (payload.meta.profile_settings && payload.meta.profile_settings.techLastName)) {
|
|
93
93
|
const techName = `${payload.meta.profile_settings.techFirstName || ""} ${payload.meta.profile_settings.techLastName || ""}`.trim();
|
|
94
94
|
form.getTextField("TechName").setText(techName);
|
|
95
95
|
}
|
|
@@ -102,13 +102,13 @@ export async function getReport(payload, options = {}) {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// Get AI summary and notes from payload or options
|
|
105
|
-
const aiSummary = options.aiSummary || util.getAiSummary
|
|
106
|
-
const notes = options.notes || util.getAiNotes
|
|
105
|
+
const aiSummary = options.aiSummary || (util.getAiSummary ? util.getAiSummary(payload) : "") || "";
|
|
106
|
+
const notes = options.notes || (util.getAiNotes ? util.getAiNotes(payload) : "") || "";
|
|
107
107
|
|
|
108
108
|
// Combine content
|
|
109
109
|
let fullContent = "";
|
|
110
110
|
if (aiSummary) {
|
|
111
|
-
fullContent += "
|
|
111
|
+
fullContent += "SUMMARY\n\n" + aiSummary + "\n\n";
|
|
112
112
|
}
|
|
113
113
|
if (notes) {
|
|
114
114
|
fullContent += "NOTES\n\n" + notes;
|
|
@@ -166,7 +166,7 @@ export async function getReport(payload, options = {}) {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
// Check if this is a title line
|
|
169
|
-
const isTitle = line === "
|
|
169
|
+
const isTitle = line === "SUMMARY" || line === "NOTES";
|
|
170
170
|
|
|
171
171
|
if (isTitle) {
|
|
172
172
|
// Add some spacing before title
|
|
@@ -260,8 +260,8 @@ function wrapText(text, font, fontSize, maxWidth) {
|
|
|
260
260
|
* @param {Object} payload - The report payload
|
|
261
261
|
*/
|
|
262
262
|
export async function addNotesSummaryPages(pdfDoc, payload) {
|
|
263
|
-
const aiSummary = util.getAiSummary
|
|
264
|
-
const notes = util.getAiNotes
|
|
263
|
+
const aiSummary = (util.getAiSummary ? util.getAiSummary(payload) : "") || "";
|
|
264
|
+
const notes = (util.getAiNotes ? util.getAiNotes(payload) : "") || "";
|
|
265
265
|
|
|
266
266
|
if (!aiSummary && !notes) return;
|
|
267
267
|
|
|
@@ -230,19 +230,34 @@ export async function getReport(payload, _test) {
|
|
|
230
230
|
form.getTextField("YourSystemScorePage2").setText(`${systemScorePercentage} ${systemScoreGrade}`);
|
|
231
231
|
|
|
232
232
|
// Print targets and range icons (using appropriate values for heat pump heating)
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
|
|
233
|
+
// Only show range icons for measurements that exist
|
|
234
|
+
// Map field names to textFields values and check if they exist
|
|
235
|
+
const measureChecks = [
|
|
236
|
+
{ label: "Superheat", value: textFields.tempRise }, // Temperature Rise
|
|
237
|
+
{ label: "Subcooling", value: textFields.llt }, // Liquid Line Temp
|
|
238
|
+
{ label: "Condenser", value: textFields.cop }, // COP/Efficiency
|
|
239
|
+
{ label: "TempSplit", value: textFields.oat }, // Outdoor Air Temp
|
|
240
|
+
{ label: "Tesp", value: textFields.tesp }, // Total External Static Pressure
|
|
241
|
+
{ label: "FilterFace", value: textFields.airflow } // Airflow
|
|
242
|
+
];
|
|
243
|
+
|
|
244
|
+
for (let i = 0; i < measureChecks.length; i++) {
|
|
245
|
+
const { label, value } = measureChecks[i];
|
|
246
|
+
// Only show range indicator if value exists (is not "--")
|
|
247
|
+
if (value && value !== "--") {
|
|
248
|
+
// For heat pump heating, we don't have typical target ranges yet
|
|
249
|
+
// Show green icon as placeholder for valid measurements
|
|
250
|
+
let icon = iconRangeGreen;
|
|
251
|
+
let iconPlacement = "Mid";
|
|
252
|
+
try {
|
|
253
|
+
form.getButton(`Image${label}${iconPlacement}_af_image`).setImage(icon);
|
|
254
|
+
} catch (e) {
|
|
255
|
+
// Field may not exist
|
|
256
|
+
}
|
|
242
257
|
}
|
|
243
258
|
// Clear target zone text for heat pump heating (different targets apply)
|
|
244
259
|
try {
|
|
245
|
-
form.getTextField(`${
|
|
260
|
+
form.getTextField(`${label}Target`).setText("");
|
|
246
261
|
} catch (e) {
|
|
247
262
|
// Field may not exist
|
|
248
263
|
}
|
|
@@ -299,7 +314,8 @@ function getTextFields(payload, test) {
|
|
|
299
314
|
cop: test.data.cop !== undefined ? (+test.data.cop).toFixed(2) : "--",
|
|
300
315
|
oat: test.data.temperature_outdoor_dry_bulb !== undefined ? (+test.data.temperature_outdoor_dry_bulb).toFixed(1) : "--",
|
|
301
316
|
tesp: test.data.pressure_static_total_external !== undefined ? (+test.data.pressure_static_total_external).toFixed(2) : "--",
|
|
302
|
-
airflow: test.data.airflow !== undefined ? (+test.data.airflow).toFixed(0) :
|
|
317
|
+
airflow: test.data.airflow !== undefined ? (+test.data.airflow).toFixed(0) :
|
|
318
|
+
(test.data.airflow_estimated !== undefined ? (+test.data.airflow_estimated).toFixed(0) : "--"),
|
|
303
319
|
// Heat pump heating scoring factors (points earned, not losses)
|
|
304
320
|
ptsFilter: test.data.hp_heating_pts_filter !== undefined ? (+test.data.hp_heating_pts_filter).toFixed(0) : "--",
|
|
305
321
|
ptsA: test.data.hp_heating_pts_a !== undefined ? (+test.data.hp_heating_pts_a).toFixed(0) : "--",
|
package/util.js
CHANGED
|
@@ -1061,10 +1061,27 @@ export function shouldShowAiSummary(payload) {
|
|
|
1061
1061
|
}
|
|
1062
1062
|
|
|
1063
1063
|
export function getAiSummary(payload) {
|
|
1064
|
-
// Check multiple possible sources for AI summary
|
|
1064
|
+
// Check multiple possible sources for AI summary (both snake_case and camelCase)
|
|
1065
1065
|
if (payload.ai_summary) return payload.ai_summary;
|
|
1066
|
+
if (payload.aiSummary) return payload.aiSummary;
|
|
1066
1067
|
if (payload.project && payload.project.ai_summary) return payload.project.ai_summary;
|
|
1068
|
+
if (payload.project && payload.project.aiSummary) return payload.project.aiSummary;
|
|
1067
1069
|
if (payload.project && payload.project.mq_ai_summary) return payload.project.mq_ai_summary;
|
|
1070
|
+
if (payload.project && payload.project.mqAiSummary) return payload.project.mqAiSummary;
|
|
1071
|
+
// Check in tests array
|
|
1072
|
+
if (payload.tests && payload.tests[0]) {
|
|
1073
|
+
if (payload.tests[0].testInfo && payload.tests[0].testInfo.aiSummary) {
|
|
1074
|
+
return payload.tests[0].testInfo.aiSummary;
|
|
1075
|
+
}
|
|
1076
|
+
if (payload.tests[0].testInfo && payload.tests[0].testInfo.ai_summary) {
|
|
1077
|
+
return payload.tests[0].testInfo.ai_summary;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
// Check aiSummaries array on project
|
|
1081
|
+
if (payload.project && payload.project.aiSummaries && payload.project.aiSummaries.length > 0) {
|
|
1082
|
+
// Return the most recent summary
|
|
1083
|
+
return payload.project.aiSummaries[payload.project.aiSummaries.length - 1];
|
|
1084
|
+
}
|
|
1068
1085
|
return null;
|
|
1069
1086
|
}
|
|
1070
1087
|
|
|
@@ -1072,8 +1089,13 @@ export function getAiNotes(payload) {
|
|
|
1072
1089
|
// Check multiple possible sources for notes
|
|
1073
1090
|
if (payload.notes) return payload.notes;
|
|
1074
1091
|
if (payload.project && payload.project.notes) return payload.project.notes;
|
|
1092
|
+
// Check in tests array
|
|
1075
1093
|
if (payload.tests && payload.tests[0] && payload.tests[0].testInfo && payload.tests[0].testInfo.notes) {
|
|
1076
1094
|
return payload.tests[0].testInfo.notes;
|
|
1077
1095
|
}
|
|
1096
|
+
// Check testInfo directly on payload (for single test payloads)
|
|
1097
|
+
if (payload.testInfo && payload.testInfo.notes) {
|
|
1098
|
+
return payload.testInfo.notes;
|
|
1099
|
+
}
|
|
1078
1100
|
return null;
|
|
1079
1101
|
}
|