@measurequick/measurequick-report-generator 1.4.26 → 1.4.28

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.4.26",
3
+ "version": "1.4.28",
4
4
  "description": "Generates PDF documents for various MeasureQuick applications.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -155,19 +155,21 @@ export async function getReport(payload) {
155
155
  }
156
156
 
157
157
  /******** CORRECTIVE MEASURES (1-2 PAGES) *********/
158
- try {
159
- let correctiveMeasuresBase64 = await correctiveMeasures.getReport(payload);
160
- const correctiveMeasuresDoc = correctiveMeasuresBase64 ? await PDFDocument.load(util._base64ToArrayBuffer(correctiveMeasuresBase64)) : false;
161
- const [_correctiveMeasuresDoc] = correctiveMeasuresDoc ? await coreDoc.copyPages(correctiveMeasuresDoc, [0]) : false;
162
- if (correctiveMeasuresDoc.getPages().length > 1) {
163
- const [_correctiveMeasuresDocPage2] = correctiveMeasuresDoc ? await coreDoc.copyPages(correctiveMeasuresDoc, [1]) : false;
164
- if (_correctiveMeasuresDoc) coreDoc.insertPage(coreDoc.getPages().length, _correctiveMeasuresDoc);
165
- if (_correctiveMeasuresDocPage2) coreDoc.insertPage(coreDoc.getPages().length, _correctiveMeasuresDocPage2);
166
- } else if (_correctiveMeasuresDoc) coreDoc.insertPage(coreDoc.getPages().length, _correctiveMeasuresDoc);
167
- } catch (error) {
168
- return { code: 400, error: error };
158
+ if (!util.projectIsGoettl(payload.project)){
159
+ try {
160
+ let correctiveMeasuresBase64 = await correctiveMeasures.getReport(payload);
161
+ const correctiveMeasuresDoc = correctiveMeasuresBase64 ? await PDFDocument.load(util._base64ToArrayBuffer(correctiveMeasuresBase64)) : false;
162
+ const [_correctiveMeasuresDoc] = correctiveMeasuresDoc ? await coreDoc.copyPages(correctiveMeasuresDoc, [0]) : false;
163
+ if (correctiveMeasuresDoc.getPages().length > 1) {
164
+ const [_correctiveMeasuresDocPage2] = correctiveMeasuresDoc ? await coreDoc.copyPages(correctiveMeasuresDoc, [1]) : false;
165
+ if (_correctiveMeasuresDoc) coreDoc.insertPage(coreDoc.getPages().length, _correctiveMeasuresDoc);
166
+ if (_correctiveMeasuresDocPage2) coreDoc.insertPage(coreDoc.getPages().length, _correctiveMeasuresDocPage2);
167
+ } else if (_correctiveMeasuresDoc) coreDoc.insertPage(coreDoc.getPages().length, _correctiveMeasuresDoc);
168
+ } catch (error) {
169
+ return { code: 400, error: error };
170
+ }
169
171
  }
170
-
172
+
171
173
  /******** PHOTOS (X PAGES) *********/
172
174
  try {
173
175
  let selectedPhotosReport = payload.meta.origin == 'virtuoso' ? photosReportS3 : photosReport;
@@ -16,6 +16,8 @@ export async function getReport(payload) {
16
16
  const formPg1 = pdfDocPg1.getForm();
17
17
  const formPg2 = pdfDocPg2.getForm();
18
18
 
19
+ const isGoettlInstall = util.projectIsGoettl(payload.project);
20
+
19
21
  let mapImagePg1, mapImagePg2;
20
22
  if (payload.map && typeof payload.map == 'string') {
21
23
  if (payload.map.includes("image/jpeg")) {
@@ -141,10 +143,10 @@ export async function getReport(payload) {
141
143
  let condDisplay = util.getElectricalData(test, "", embeddedIcons);
142
144
  let ahuDisplay = util.getElectricalData(test, "_ahu", embeddedIcons);
143
145
  if (measurement) {
144
- if (measurement.label == "Cond. Volts" && condDisplay.voltageIcon) form.getButton(`Block${blockNum}-Row${rowNum}-Col4`).setImage(condDisplay.voltageIcon);
145
- else if (measurement.label == "Cond. Amps" && condDisplay.amperageIcon) form.getButton(`Block${blockNum}-Row${rowNum}-Col4`).setImage(condDisplay.amperageIcon);
146
- else if (measurement.label == "AHU Volts" && ahuDisplay.voltageIcon) form.getButton(`Block${blockNum}-Row${rowNum}-Col4`).setImage(ahuDisplay.voltageIcon);
147
- else if (measurement.label == "AHU Amps" && ahuDisplay.amperageIcon) form.getButton(`Block${blockNum}-Row${rowNum}-Col4`).setImage(ahuDisplay.amperageIcon);
146
+ if (!isGoettlInstall && measurement.label == "Cond. Volts" && condDisplay.voltageIcon) form.getButton(`Block${blockNum}-Row${rowNum}-Col4`).setImage(condDisplay.voltageIcon);
147
+ else if (!isGoettlInstall && measurement.label == "Cond. Amps" && condDisplay.amperageIcon) form.getButton(`Block${blockNum}-Row${rowNum}-Col4`).setImage(condDisplay.amperageIcon);
148
+ else if (!isGoettlInstall && measurement.label == "AHU Volts" && ahuDisplay.voltageIcon) form.getButton(`Block${blockNum}-Row${rowNum}-Col4`).setImage(ahuDisplay.voltageIcon);
149
+ else if (!isGoettlInstall && measurement.label == "AHU Amps" && ahuDisplay.amperageIcon) form.getButton(`Block${blockNum}-Row${rowNum}-Col4`).setImage(ahuDisplay.amperageIcon);
148
150
  let units = measurement.units ? `(${measurement.units})` : "";
149
151
  let altLabel = "";
150
152
  if (payload.meta.report_mode != 'heating' && blockNum == 1 && (rowNum == 4 || rowNum == 5 || rowNum == 6 || rowNum == 9)) altLabel = "c";
@@ -125,7 +125,7 @@ export async function getReport(payload, _test) {
125
125
  let systemScorePercentage = t.data.vitals_score ? +t.data.vitals_score.toFixed(0) : 0;
126
126
  let systemScoreGrade = util.getGradeFromScore(systemScorePercentage);
127
127
  let systemScoreColor = util.getColorFromGrade(systemScoreGrade);
128
- if (!t.data.vitals_score) {
128
+ if (!t.data.vitals_score || payload.meta.non_invasive) {
129
129
  systemScorePercentage = "--";
130
130
  systemScoreGrade = "";
131
131
  } else systemScorePercentage += "%";
@@ -114,7 +114,7 @@ export async function getReport(payload, _test) {
114
114
  let systemScorePercentage = test.testInfo.data.vitals_score ? +test.testInfo.data.vitals_score.toFixed(0) : 0;
115
115
  let systemScoreGrade = util.getGradeFromScore(systemScorePercentage);
116
116
  let systemScoreColor = util.getColorFromGrade(systemScoreGrade);
117
- if (!t.data.vitals_score) {
117
+ if (!t.data.vitals_score || payload.meta.non_invasive) {
118
118
  systemScorePercentage = "--";
119
119
  systemScoreGrade = "";
120
120
  } else systemScorePercentage += "%";
package/util.js CHANGED
@@ -19,6 +19,66 @@ export function checkCompanyLogo(meta) {
19
19
  }
20
20
  }
21
21
 
22
+ export function projectIsGoettl(project) {
23
+ if (!project) return false;
24
+ let typeValid = (project.specialProjectType &&
25
+ (project.specialProjectType === 'Goettl - Package Heat Pump' ||
26
+ project.specialProjectType === 'Goettl - Heat Pump Horizontal' ||
27
+ project.specialProjectType === 'Goettl - Upflow Split' ||
28
+ project.specialProjectType === 'Package Heat Pumps' ||
29
+ project.specialProjectType === 'Horizontal Split Heat Pumps' ||
30
+ project.specialProjectType === 'Horizontal Hydronic Attic' ||
31
+ project.specialProjectType === 'Ceiling Mount Units' ||
32
+ project.specialProjectType === 'Wall Mounted Units (Heat Pump & Hydronic)' ||
33
+ project.specialProjectType === 'Up Flow Split Heat Pumps' ||
34
+ project.specialProjectType === 'Stand Alone Hydronic Up Flow Garage' ||
35
+ project.specialProjectType === 'Manufactured Home Split Heat Pumps' ||
36
+ project.specialProjectType === 'Manufactured Home Package Units' ||
37
+ this.projectIsGoettlGas(project))) ? true : false;
38
+ let subTypeValid = (project.specialProjectSubType &&
39
+ (project.specialProjectSubType === 'Goettl - Package Heat Pump' ||
40
+ project.specialProjectSubType === 'Goettl - Heat Pump Horizontal' ||
41
+ project.specialProjectSubType === 'Goettl - Upflow Split' ||
42
+ project.specialProjectSubType === 'Package Heat Pumps' ||
43
+ project.specialProjectSubType === 'Horizontal Split Heat Pumps' ||
44
+ project.specialProjectSubType === 'Horizontal Hydronic Attic' ||
45
+ project.specialProjectSubType === 'Ceiling Mount Units' ||
46
+ project.specialProjectSubType === 'Wall Mounted Units (Heat Pump & Hydronic)' ||
47
+ project.specialProjectSubType === 'Up Flow Split Heat Pumps' ||
48
+ project.specialProjectSubType === 'Stand Alone Hydronic Up Flow Garage' ||
49
+ project.specialProjectSubType === 'Manufactured Home Split Heat Pumps' ||
50
+ project.specialProjectSubType === 'Manufactured Home Package Units' ||
51
+ this.projectIsGoettlGas(project))) ? true : false;
52
+ return (typeValid || subTypeValid) ? true : false;
53
+ }
54
+
55
+ export function projectIsGoettlGas(project) {
56
+ if (!project) return false;
57
+ let typeValid = (project.specialProjectType &&
58
+ (project.specialProjectType === 'Goettl - Gas Package Unit' ||
59
+ project.specialProjectType === 'Goettl - Horizontal Split Gas' ||
60
+ project.specialProjectType === 'Goettl - Upflow Gas Split' ||
61
+ project.specialProjectType === 'Package Gas Units' ||
62
+ project.specialProjectType === 'Horizontal Split Gas Units' ||
63
+ project.specialProjectType === 'Condensing Category 4 Horizontal Furnace Splits' ||
64
+ project.specialProjectType === 'Up Flow Split Gas Units' ||
65
+ project.specialProjectType === 'Condensing Category 4 Up Flow Furnace Splits' ||
66
+ project.specialProjectType === 'Manufactured Home Split Gas Units' ||
67
+ project.specialProjectType === 'Down Flow Manufactured Home Furnaces')) ? true : false;
68
+ let subTypeValid = (project.specialProjectSubType &&
69
+ (project.specialProjectSubType === 'Goettl - Gas Package Unit' ||
70
+ project.specialProjectSubType === 'Goettl - Horizontal Split Gas' ||
71
+ project.specialProjectSubType === 'Goettl - Upflow Gas Split' ||
72
+ project.specialProjectSubType === 'Package Gas Units' ||
73
+ project.specialProjectSubType === 'Horizontal Split Gas Units' ||
74
+ project.specialProjectSubType === 'Condensing Category 4 Horizontal Furnace Splits' ||
75
+ project.specialProjectSubType === 'Up Flow Split Gas Units' ||
76
+ project.specialProjectSubType === 'Condensing Category 4 Up Flow Furnace Splits' ||
77
+ project.specialProjectSubType === 'Manufactured Home Split Gas Units' ||
78
+ project.specialProjectSubType === 'Down Flow Manufactured Home Furnaces')) ? true : false;
79
+ return (typeValid || subTypeValid) ? true : false;
80
+ }
81
+
22
82
  export function checkProfilePicture(meta) {
23
83
  if (meta.pdf_settings.includeProfilePic) {
24
84