@measurequick/measurequick-report-generator 1.5.77 → 1.5.78

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.77",
3
+ "version": "1.5.78",
4
4
  "description": "Generates PDF documents for various measureQuick applications.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -32,6 +32,7 @@ export async function getReport(payload) {
32
32
  // Process All Photos
33
33
  let docIndex = 0;
34
34
  let photos = payload.photos.project;
35
+ let hasPhotos = false;
35
36
  if (photos.unsynced && typeof photo.unsynced === 'object') delete photos.unsynced;
36
37
  if (photos && Object.keys(photos) && Object.keys(photos).length > 0) {
37
38
  let s3ReferenceIds = Object.keys(photos);
@@ -58,6 +59,7 @@ export async function getReport(payload) {
58
59
  }
59
60
  let imageToSet;
60
61
  if (photo && photo.base64 && typeof photo.base64 == 'string') {
62
+ hasPhotos = true;
61
63
  if (photo.base64 && photo.base64.includes("image/jpeg")) imageToSet = await docs[docIndex].embedJpg(util._base64ToArrayBuffer(photo.base64));
62
64
  else if (photo.base64 && photo.base64.includes("image/png")) imageToSet = await docs[docIndex].embedPng(util._base64ToArrayBuffer(photo.base64));
63
65
  }
@@ -68,7 +70,8 @@ export async function getReport(payload) {
68
70
  photoPosition++;
69
71
  prevSection = currSection;
70
72
  }
71
- docIndex++;
73
+ if (hasPhotos)
74
+ docIndex++;
72
75
  }
73
76
 
74
77
  // Prepare Deliverable
@@ -98,7 +98,7 @@ export async function getReport(payload) {
98
98
  }
99
99
  }
100
100
  if (hasPhotos)
101
- this.docIndex++;
101
+ docIndex++;
102
102
  }
103
103
 
104
104
  let initialEquipmentPhotoPageLoaded = false;