@measurequick/measurequick-report-generator 1.5.156 → 1.5.159

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.5.156",
3
+ "version": "1.5.159",
4
4
  "description": "Generates PDF documents for various measureQuick applications.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -196,17 +196,27 @@ export async function getReport(payload, _test) {
196
196
  `${systemScorePercentage} ${systemScoreGrade}`
197
197
  );
198
198
 
199
- if (+textFields.co_ambient > 9) {
199
+ // CO warning based on ambient CO only
200
+ var data = t && t.data ? t.data : {};
201
+ function toNum(v) {
202
+ var n = Number(v);
203
+ return isFinite(n) ? n : NaN;
204
+ }
205
+ var coAmbRaw = toNum(data && data.co_ambient);
206
+ if (isFinite(coAmbRaw) && coAmbRaw > 9) {
200
207
  safeSetText(
201
208
  form,
202
209
  "COWarning",
203
- `WARNING: Elevated CO above 9 ppm Detected!\nVentilate the area and investigate the source.`
210
+ "WARNING: Elevated CO above 9 ppm Detected!\\nVentilate the area and investigate the source."
204
211
  );
205
212
  safeSetText(
206
213
  form,
207
214
  "COWarning2",
208
- `WARNING: Elevated CO above 9 ppm Detected! Ventilate the area and investigate the source.`
215
+ "WARNING: Elevated CO above 9 ppm Detected! Ventilate the area and investigate the source."
209
216
  );
217
+ } else {
218
+ safeSetText(form, "COWarning", "");
219
+ safeSetText(form, "COWarning2", "");
210
220
  }
211
221
 
212
222
  //form.getTextField("COaf").setText(`${textFields.coaf} ppm`);
@@ -196,21 +196,36 @@ export async function getReport(payload, _test) {
196
196
  `${systemScorePercentage} ${systemScoreGrade}`
197
197
  );
198
198
 
199
- if (
200
- +textFields.co_ambient > 9 ||
201
- +textFields.co_return > 9 ||
202
- +textFields.co_supply > 9
203
- ) {
199
+ // Show CO warnings based on raw values (avoid false negatives from rounded display strings)
200
+ var data = t && t.data ? t.data : {};
201
+ function toNum(v) {
202
+ var n = Number(v);
203
+ return isFinite(n) ? n : NaN;
204
+ }
205
+ var coAmbRaw = toNum(data && data.co_ambient);
206
+ var coRetRaw = toNum(data && data.co_return);
207
+ var coSupRaw = toNum(data && data.co_supply);
208
+
209
+ var coHigh =
210
+ (isFinite(coAmbRaw) && coAmbRaw > 9) ||
211
+ (isFinite(coRetRaw) && coRetRaw > 9) ||
212
+ (isFinite(coSupRaw) && coSupRaw > 9);
213
+
214
+ if (coHigh) {
204
215
  safeSetText(
205
216
  form,
206
217
  "COWarning",
207
- `WARNING: Elevated CO above 9 ppm Detected!\nVentilate the area and investigate the source.`
218
+ "WARNING: Elevated CO above 9 ppm Detected!\\nVentilate the area and investigate the source."
208
219
  );
209
220
  safeSetText(
210
221
  form,
211
222
  "COWarning2",
212
- `WARNING: Elevated CO above 9 ppm Detected! Ventilate the area and investigate the source.`
223
+ "WARNING: Elevated CO above 9 ppm Detected! Ventilate the area and investigate the source."
213
224
  );
225
+ } else {
226
+ // clear warnings if not applicable
227
+ safeSetText(form, "COWarning", "");
228
+ safeSetText(form, "COWarning2", "");
214
229
  }
215
230
 
216
231
  safeSetText(form, "COaf", `${textFields.coaf} ppm`);