@measurequick/measurequick-report-generator 1.0.58 → 1.0.61

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.
@@ -3,12 +3,13 @@ import * as templates from "../templates/js/templates.js";
3
3
  import * as request from "../templates/js/request.js";
4
4
 
5
5
  let jsPDF = require("jspdf");
6
- let doc = new jsPDF(templates.docOptions);
6
+ let doc;
7
7
  let reportData;
8
8
  let currentSnapshot;
9
9
 
10
10
  export function generateReport(reportType, payload) {
11
11
  try {
12
+ doc = new jsPDF(templates.docOptions);
12
13
  reportData = JSON.parse(JSON.stringify(payload));
13
14
  let testNumber = 0;
14
15
  for (currentSnapshot in reportData.snapshots) {
@@ -120,7 +121,8 @@ function printBodySection(currentSnapshot, measurementSection, xLeft, xRight, y)
120
121
  let valueText = "";
121
122
  let yTop = y;
122
123
  let s = .18;
123
- let sMultiplier = measurementSection == "performanceData" ? 2 : 1;
124
+ // let sMultiplier = measurementSection == "performanceData" ? 2 : 1;
125
+ let sMultiplier = 1;
124
126
 
125
127
  for (let key in dataPoints.values) {
126
128
  let dataPoint = dataPoints.values[key];
@@ -144,7 +146,7 @@ function printBodySection(currentSnapshot, measurementSection, xLeft, xRight, y)
144
146
  valueText = `${dataPoint} / ${secondaryDataPoint}`;
145
147
  } else valueText = `${dataPoint}`;
146
148
  if (templateRef.label) doc.text(labelText, xLeft, y);
147
- if (isNaN(valueText) || !valueText) valueText = "--";
149
+ //if (isNaN(valueText) || !valueText) valueText = "--";
148
150
  doc.text(valueText, alignRight(valueText, xRight, 8), y);
149
151
  if (printRangeIcons) {
150
152
  let rangeIconRef = getRangeIcon(key, valueBeforeEditing, currentSnapshot);
@@ -225,7 +227,7 @@ function printDiagnosticPage() {
225
227
  doc.addPage();
226
228
  printBoilerPlateDiagnostic();
227
229
  printSubsystemReview();
228
- // printSystemDiagnostics();
230
+ printSystemDiagnostics();
229
231
  printCorrectiveActions();
230
232
  }
231
233
 
@@ -235,7 +237,9 @@ function printSubsystemReview() {
235
237
  let ssr = JSON.parse(reportData.subsystemReview);
236
238
  for (let i = 0; i < Object.keys(ssr).length; i++) {
237
239
  let key = Object.keys(ssr)[i];
240
+ doc.setTextColor(0, 0, 0);
238
241
  doc.text(templateRef[key], .25, y);
242
+ setColor(ssr[key]);
239
243
  doc.text(ssr[key], 3, y);
240
244
  y += .15;
241
245
  };
@@ -248,11 +252,11 @@ function printSystemDiagnostics() {
248
252
  let key = Object.keys(diagnostics)[i];
249
253
  let score = diagnostics[key].score;
250
254
  let diagnosticIcon = graphics.iconFlagGreen;
251
- if (type === 'stability') icon = stability;
255
+ if (diagnostics[key].type === 'stability') diagnosticIcon = graphics.iconStability;
252
256
  else if (score > 1 && score < 10) diagnosticIcon = graphics.iconFlagRed;
253
257
  else if (score >= 10 && score < 15) diagnosticIcon = graphics.iconFlagYellow;
254
258
  else if (score >= 15) diagnosticIcon = graphics.iconFlagBlack;
255
- if (diagnosticIcon) doc.addImage(graphics[diagnosticIcon], "JPEG", 7.8, y, .25, .25);
259
+ //if (diagnosticIcon) doc.addImage(diagnosticIcon, "JPEG", 7.8, y, .25, .25);
256
260
  y += .2;
257
261
  doc.text(diagnostics[key].title, 4.4375, y);
258
262
  doc.text(`${diagnostics[key].score}`, 7.5, y);
@@ -269,13 +273,13 @@ function printCorrectiveActions() {
269
273
  let actionKey = Object.keys(ca[sectionKey])[j];
270
274
  let action = ca[sectionKey][actionKey];
271
275
  if (actionKey == "header") {
272
- doc.setFontSize(10);
276
+ doc.setFontSize(9);
273
277
  doc.setFontStyle("bold");
274
- doc.text(getTextFromAction(action), .25, y);
278
+ doc.text(action, .25, y);
275
279
  } else {
276
280
  doc.setFontSize(8);
277
281
  doc.setFontStyle("normal");
278
- doc.text(actionKey, .25, y);
282
+ doc.text(getCorrectiveActionNameFromTag(actionKey), .25, y);
279
283
  }
280
284
  y += .18;
281
285
  }
@@ -374,6 +378,12 @@ function getPhotoSectionNameFromTag(tag) {
374
378
  return sectionName;
375
379
  }
376
380
 
381
+ function getCorrectiveActionNameFromTag(tag) {
382
+ let tagUnderscoresReplaced = tag.replaceAll('_', ' ');
383
+ let sectionName = `${tagUnderscoresReplaced.charAt(0).toUpperCase()}${tagUnderscoresReplaced.slice(1)}`;
384
+ return sectionName;
385
+ }
386
+
377
387
  function resizeAndPrintStaticImages() {
378
388
  let wMax = 2.25,
379
389
  hMax = .7,
@@ -443,6 +453,12 @@ function getToolIcon(measurementSource) {
443
453
  }
444
454
  }
445
455
 
456
+ function setColor(measure) {
457
+ if (measure == 'Pass') doc.setTextColor(55, 99, 45);
458
+ else if (measure == 'Fail') doc.setTextColor(157, 45, 54);
459
+ else doc.setTextColor(0,0,0);
460
+ }
461
+
446
462
  function getRangeIcon(key, actualValue, currentSnapshot) {
447
463
  let ranges = JSON.parse(reportData.snapshots[currentSnapshot].rangeIcons);
448
464
  let target = null, low = null, high = null;
@@ -460,10 +476,6 @@ function getRangeIcon(key, actualValue, currentSnapshot) {
460
476
  return rangeIconRef;
461
477
  }
462
478
 
463
- function getTextFromAction(action) {
464
- return action;
465
- }
466
-
467
479
  function alignRight(text, rightAlign, fontSize) {
468
480
  return rightAlign - doc.getStringUnitWidth(text) * fontSize / 72;
469
481
  }
@@ -124,7 +124,8 @@ export async function generateReport(payload) {
124
124
  // print pass fail measures
125
125
  let passFails = ["electrical_system_pass_fail", "air_distribution_system_pass_fail", "air_filtration_system_pass_fail", "condensate_drain_system_pass_fail", "refrigerant_charge_pass_fail", "outdoor_equipment_pass_fail", "indoor_equipment_pass_fail", "cooling_capacity_pass_fail", "cooling_electrical_efficiency_pass_fail"];
126
126
  for (let i = 1; i <= passFails.length; i++) {
127
- let icon = payload.test[passFails[i - 1]] == "Pass" ? iconRangeGreen : iconRangeRed;
127
+ let meas = payload.test[passFails[i - 1]];
128
+ let icon = meas == "Pass" || meas == "High" || meas == "Mid" ? iconRangeGreen : iconRangeRed;
128
129
  form.getButton(`ImageSubsystem${i}_af_image`).setImage(icon);
129
130
  }
130
131
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measurequick/measurequick-report-generator",
3
- "version": "1.0.58",
3
+ "version": "1.0.61",
4
4
  "description": "Generates PDF documents for various MeasureQuick applications.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -304,13 +304,13 @@ export const outdoorMeasurements = {
304
304
  "pressure_evaporator": {
305
305
  "label": "Low Pressure",
306
306
  "units": ["PSIG", "°F"],
307
- "secondaryValue": "lowSideTemperature",
307
+ "secondaryValue": "temperature_saturation_evaporator",
308
308
  "roundTo": 1
309
309
  },
310
310
  "pressure_condenser": {
311
311
  "label": "High Pressure",
312
312
  "units": ["PSIG", "°F"],
313
- "secondaryValue": "highSideTemperature",
313
+ "secondaryValue": "temperature_saturation_condenser",
314
314
  "roundTo": 1
315
315
  },
316
316
  "temperature_suction_line_condenser": {
@@ -374,33 +374,29 @@ export const performanceData = {
374
374
  "label": "Actual"
375
375
  },
376
376
  "capacityActualNormalized": {
377
- "label": "TestLabel"
377
+ "label": ""
378
378
  },
379
379
  "capacitySensible": {
380
380
  "label": "Sensible"
381
381
  },
382
382
  "capacitySensibleNormalized": {
383
- "label": "TestLabel"
383
+ "label": ""
384
384
  },
385
385
  "capacityLatent": {
386
386
  "label": "Latent"
387
387
  },
388
388
  "capacityLatentNormalized": {
389
- "label": "TestLabel"
389
+ "label": ""
390
390
  },
391
391
  "sensibleHeatRatio": {
392
392
  "label": "Sensible Heat Ratio",
393
393
  "roundTo": 2
394
394
  },
395
395
  "temperatureSplitTarget": {
396
- "label": "Temp Split Target",
397
- "units": "°F",
398
- "roundTo": 1
396
+ "label": "Temp Split Target"
399
397
  },
400
398
  "temperatureSplit": {
401
- "label": "Temp Split",
402
- "units": "°F",
403
- "roundTo": 1
399
+ "label": "Temp Split"
404
400
  },
405
401
  "dehumidification": {
406
402
  "label": "Dehumidification",
@@ -428,6 +424,10 @@ export const performanceData = {
428
424
  "sensibleEfficiency": {
429
425
  "label": "Sensible Efficiency",
430
426
  "roundTo": 1
427
+ },
428
+ "filterFaceVelocity": {
429
+ "label": "Fltr. Face Vel.",
430
+ "roundTo": 1
431
431
  }
432
432
  };
433
433
 
@@ -479,6 +479,9 @@ export const systemProfileWeatherData = {
479
479
  },
480
480
  "systemStability": {
481
481
  "label": "System Stability"
482
+ },
483
+ "systemBenchmarked": {
484
+ "label": "System Benchmarked"
482
485
  }
483
486
  };
484
487