@measurequick/measurequick-report-generator 1.1.76 → 1.1.77
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
|
@@ -16,8 +16,7 @@ export async function getReport(payload) {
|
|
|
16
16
|
"iconBluflame", "iconRedfish510", "iconRedfish510333", "iconRedfish550", "iconDg1000", "iconTrueflow", "iconThumbprintRed", "iconThumbprintGreen", "iconThumbprintYellow"];
|
|
17
17
|
for (let label of labels) embeddedIcons[label] = await pdfDoc.embedPng(util._base64ToArrayBuffer(base64[label]));
|
|
18
18
|
|
|
19
|
-
let
|
|
20
|
-
let systemScorePercentage = +(100 - +(scoreDeduction.toFixed(0)));
|
|
19
|
+
let systemScorePercentage = +payload.meta.score.toFixed(0);
|
|
21
20
|
let systemScoreGrade = util.getGradeFromScore(systemScorePercentage);
|
|
22
21
|
let systemScoreColor = util.getColorFromGrade(systemScoreGrade);
|
|
23
22
|
form.getTextField(`YourSystemScore${systemScoreColor}`).setText(`${systemScorePercentage}% ${systemScoreGrade}`);
|
|
@@ -46,8 +46,7 @@ export async function getReport(payload) { console.log(payload);
|
|
|
46
46
|
form.getTextField('Time of Service').setText(date.toLocaleTimeString("en-US"));
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
let
|
|
50
|
-
let systemScorePercentage = +(100 - +(scoreDeduction.toFixed(0)));
|
|
49
|
+
let systemScorePercentage = +payload.meta.score.toFixed(0);
|
|
51
50
|
let systemScoreGrade = util.getGradeFromScore(systemScorePercentage);
|
|
52
51
|
let systemScoreColor = util.getColorFromGrade(systemScoreGrade);
|
|
53
52
|
form.getTextField(`YourSystemScore${systemScoreColor}`).setText(`${systemScorePercentage}% ${systemScoreGrade}`);
|
|
@@ -35,20 +35,15 @@ export async function getReport(payload) { console.log(payload);
|
|
|
35
35
|
const form = pdfDoc.getForm();
|
|
36
36
|
|
|
37
37
|
// print system diagnostics section
|
|
38
|
-
let scoreDeduction = 0;
|
|
39
38
|
let t = payload.tests[0].testInfo;
|
|
40
39
|
if (t && t.diagnostics && t.diagnostics.multi_point_analysis && t.diagnostics.multi_point_analysis.length > 0) {
|
|
41
40
|
for (let i = 0; i < 9; i++) {
|
|
42
41
|
let d = t.diagnostics.multi_point_analysis[i];
|
|
43
42
|
if (d) {
|
|
44
43
|
let diagnosticIcon = iconFlagBlack;
|
|
45
|
-
if (d.type === 'stability')
|
|
46
|
-
|
|
47
|
-
else if (d.score
|
|
48
|
-
diagnosticIcon = iconFlagRed;
|
|
49
|
-
scoreDeduction += d.score;
|
|
50
|
-
} else if (d.score >= 10 && d.score < 15)
|
|
51
|
-
diagnosticIcon = iconFlagYellow;
|
|
44
|
+
if (d.type === 'stability') diagnosticIcon = iconStability;
|
|
45
|
+
else if (d.score > 1 && d.score < 10) diagnosticIcon = iconFlagRed;
|
|
46
|
+
else if (d.score >= 10 && d.score < 15) diagnosticIcon = iconFlagYellow;
|
|
52
47
|
form.getButton(`ImageDiagnostics${i+1}_af_image`).setImage(diagnosticIcon);
|
|
53
48
|
form.getTextField(`SystemDiagnostics${i+1}`).setText(`${d.title}`);
|
|
54
49
|
form.getTextField(`SystemDiagnostics${i+1}a`).setText(`${d.score}`);
|
|
@@ -58,11 +53,8 @@ export async function getReport(payload) { console.log(payload);
|
|
|
58
53
|
form.getButton("ImageDiagnostics1_af_image").setImage(iconFlagGreen);
|
|
59
54
|
form.getTextField("SystemDiagnostics1").setText("No system-wide issues were detected.");
|
|
60
55
|
}
|
|
61
|
-
if (t.score_deduction) {
|
|
62
|
-
scoreDeduction = t.score_deduction;
|
|
63
|
-
}
|
|
64
56
|
|
|
65
|
-
let systemScorePercentage = +
|
|
57
|
+
let systemScorePercentage = +payload.meta.score.toFixed(0);
|
|
66
58
|
let systemScoreGrade = util.getGradeFromScore(systemScorePercentage);
|
|
67
59
|
let systemScoreColor = util.getColorFromGrade(systemScoreGrade);
|
|
68
60
|
|
|
@@ -35,9 +35,7 @@ export async function getReport(payload) { console.log("Vitals Heating Report");
|
|
|
35
35
|
const form = pdfDoc.getForm();
|
|
36
36
|
|
|
37
37
|
// print system diagnostics section
|
|
38
|
-
let
|
|
39
|
-
|
|
40
|
-
let systemScorePercentage = payload.tests[0].testInfo.data.efficiency_gcv;
|
|
38
|
+
let systemScorePercentage = +payload.meta.score.toFixed(0);
|
|
41
39
|
let systemScoreGrade = util.getGradeFromScore(systemScorePercentage);
|
|
42
40
|
let systemScoreColor = util.getColorFromGrade(systemScoreGrade);
|
|
43
41
|
|
|
@@ -142,7 +140,7 @@ export async function getReport(payload) { console.log("Vitals Heating Report");
|
|
|
142
140
|
// print pass fail measures
|
|
143
141
|
let passFails = ["ambient_co_pass_fail", "control_system_pass_fail", "electrical_system_pass_fail", "air_distribution_system_pass_fail", "air_filtration_system_pass_fail", "condensate_drain_system_pass_fail", "indoor_equipment_pass_fail", "venting_system_pass_fail", "fuel_delivery_system_pass_fail", "make_up_air_system_pass_fail", "heat_exchanger_pass_fail", "safety_system_pass_fail", "heating_operation_pass_fail", "combustion_safety_pass_fail", "combustion_efficiency_pass_fail"];
|
|
144
142
|
for (let i = 1; i <= passFails.length; i++) {
|
|
145
|
-
let meas =
|
|
143
|
+
let meas = test[passFails[i - 1]];
|
|
146
144
|
let icon = meas == "Pass" || meas == "High" || meas == "Mid" ? iconRangeGreen : iconRangeRed;
|
|
147
145
|
form.getButton(`ImageSubsystem${i}_af_image`).setImage(icon);
|
|
148
146
|
}
|
package/util.js
CHANGED
|
@@ -37,7 +37,7 @@ export function getColorFromGrade(grade) {
|
|
|
37
37
|
|
|
38
38
|
export function getToolIcon(test, ref, embeddedIcons) {
|
|
39
39
|
let toolIcon;
|
|
40
|
-
if (test.data.calculated[ref]) toolIcon = embeddedIcons.iconCalculator;
|
|
40
|
+
if (test.data.calculated && test.data.calculated[ref]) toolIcon = embeddedIcons.iconCalculator;
|
|
41
41
|
else {
|
|
42
42
|
switch (test.source[ref]) {
|
|
43
43
|
case "Testo": toolIcon = embeddedIcons.iconTesto; break;
|