tango-app-api-store-builder 1.0.0-beta-147 → 1.0.0-beta-149

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": "tango-app-api-store-builder",
3
- "version": "1.0.0-beta-147",
3
+ "version": "1.0.0-beta-149",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,7 +1,7 @@
1
1
  import * as floorService from '../service/storeBuilder.service.js';
2
2
  import { logger, insertOpenSearchData } from 'tango-app-api-middleware';
3
3
  // import * as storeService from '../service/store.service.js';
4
- import * as planoService from '../service/planogram.service.js';
4
+ // import * as planoService from '../service/planogram.service.js';
5
5
  import * as storeFixtureService from '../service/storeFixture.service.js';
6
6
  import * as fixtureShelfService from '../service/fixtureShelf.service.js';
7
7
  // import * as planoProductService from '../service/planoProduct.service.js';
@@ -677,12 +677,7 @@ export async function updateFixtureStatus( req, res ) {
677
677
  if ( vmTask.length>0 ) {
678
678
  let allTaskDone = vmTask.filter( ( data ) => data.status === 'incomplete' );
679
679
  if ( allTaskDone.length === 0 ) {
680
- await planoService.updateOne(
681
- {
682
- _id: new mongoose.Types.ObjectId( req.body.planoId ),
683
- },
684
- { $set: { planoProgress: 100 } },
685
- );
680
+ await floorService.updateOne( { _id: taskData?.floorId }, { planoProgress: 100 } );
686
681
  }
687
682
  }
688
683
  res.sendSuccess( 'updated successfully' );
@@ -632,7 +632,20 @@ export async function updateAnswersv2( req, res ) {
632
632
  }
633
633
 
634
634
  await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).planotaskcompliances, data );
635
+ let vmTask = await planoTaskService.find(
636
+ {
637
+ planoId: new mongoose.Types.ObjectId( req.body.planoId ),
638
+ floorId: new mongoose.Types.ObjectId( req.body.floorId ),
639
+ type: 'vm',
640
+ },
635
641
 
642
+ );
643
+ if ( vmTask.length>0 ) {
644
+ let allTaskDone = vmTask.filter( ( data ) => data.status === 'incomplete' );
645
+ if ( allTaskDone.length === 0 ) {
646
+ await floorService.updateOne( { _id: taskData?.floorId }, { planoProgress: 100 } );
647
+ }
648
+ }
636
649
  return res.sendSuccess( 'Fixture details updated successfully' );
637
650
  } catch ( e ) {
638
651
  logger.error( { functionName: 'updateAnswers', error: e } );