tango-app-api-store-builder 1.0.0-beta-18 → 1.0.0-beta-19
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
|
@@ -1201,8 +1201,10 @@ export async function scanv1( req, res ) {
|
|
|
1201
1201
|
|
|
1202
1202
|
let misplacedProductDetails = await planoProductService.findOne( { _id: misplacedProductMapping.toObject().productId } );
|
|
1203
1203
|
|
|
1204
|
-
await planoComplianceService.
|
|
1205
|
-
|
|
1204
|
+
const isComplianceProper = await planoComplianceService.count( { ...misplacedQuery, date: currentDate, compliance: 'proper' } );
|
|
1205
|
+
if ( !isComplianceProper ) {
|
|
1206
|
+
await planoComplianceService.updateOne( { ...misplacedQuery, date: currentDate, compliance: { $ne: 'proper' } }, complianceData );
|
|
1207
|
+
}
|
|
1206
1208
|
|
|
1207
1209
|
const [ totalProducts, scannedProducts, misplacedProducts, missingProducts, properProducts ] = await Promise.all( [
|
|
1208
1210
|
planoMappingService.count( { fixtureId: fixture.toObject()._id } ),
|
|
@@ -1339,12 +1341,12 @@ export async function scanv1( req, res ) {
|
|
|
1339
1341
|
proper: properProducts,
|
|
1340
1342
|
};
|
|
1341
1343
|
const [ shelfProducts, shelfCompliance ] = await Promise.all( [
|
|
1342
|
-
planoMappingService.count( { shelfId:
|
|
1343
|
-
planoComplianceService.count( { date: currentDate, shelfId:
|
|
1344
|
+
planoMappingService.count( { shelfId: misplacedProductMapping.toObject().shelfId } ),
|
|
1345
|
+
planoComplianceService.count( { date: currentDate, shelfId: misplacedProductMapping.toObject().shelfId, compliance: 'proper' } ),
|
|
1344
1346
|
] );
|
|
1345
1347
|
|
|
1346
1348
|
const shelfMetrics = {
|
|
1347
|
-
shelfId:
|
|
1349
|
+
shelfId: misplacedProductMapping.toObject().shelfId,
|
|
1348
1350
|
isScanned: shelfCompliance >= shelfProducts/2 ? true : false };
|
|
1349
1351
|
|
|
1350
1352
|
return res.sendSuccess( { data: { ...misplacedProductMapping.toObject(), ...( misplacedProductDetails ? misplacedProductDetails?.toObject() : {} ) },
|
|
@@ -1415,7 +1417,7 @@ export async function scanv1( req, res ) {
|
|
|
1415
1417
|
const productMapping = await planoMappingService.findOne( mappingQuery );
|
|
1416
1418
|
|
|
1417
1419
|
if ( !productMapping ) {
|
|
1418
|
-
shelf = await fixtureShelfService.findOne(
|
|
1420
|
+
const shelf = await fixtureShelfService.findOne( mappingQuery );
|
|
1419
1421
|
if ( !shelf ) {
|
|
1420
1422
|
return res.sendSuccess( { data: null, status: 'missing' } );
|
|
1421
1423
|
}
|
|
@@ -1433,7 +1435,12 @@ export async function scanv1( req, res ) {
|
|
|
1433
1435
|
|
|
1434
1436
|
let productDetails = await planoProductService.findOne( { _id: productMapping.toObject().productId } );
|
|
1435
1437
|
|
|
1436
|
-
await planoComplianceService.
|
|
1438
|
+
const isComplianceProper = await planoComplianceService.count( { ...mappingQuery, date: currentDate, compliance: 'proper' } );
|
|
1439
|
+
|
|
1440
|
+
if ( !isComplianceProper ) {
|
|
1441
|
+
await planoComplianceService.updateOne( { ...mappingQuery, date: currentDate }, complianceData );
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1437
1444
|
|
|
1438
1445
|
const [ totalProducts, scannedProducts, misplacedProducts, missingProducts, properProducts ] = await Promise.all( [
|
|
1439
1446
|
planoMappingService.count( { fixtureId: fixture.toObject()._id } ),
|
|
@@ -1441,7 +1448,6 @@ export async function scanv1( req, res ) {
|
|
|
1441
1448
|
planoComplianceService.count( { fixtureId: fixture.toObject()._id, date: currentDate, compliance: 'misplaced' } ),
|
|
1442
1449
|
planoComplianceService.count( { fixtureId: fixture.toObject()._id, date: currentDate, compliance: 'missing' } ),
|
|
1443
1450
|
planoComplianceService.count( { fixtureId: fixture.toObject()._id, date: currentDate, compliance: 'proper' } ),
|
|
1444
|
-
|
|
1445
1451
|
] );
|
|
1446
1452
|
|
|
1447
1453
|
const fixtureMetrics = {
|