tango-app-api-store-builder 1.0.0-beta-188 → 1.0.0-beta-189
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
|
@@ -1307,7 +1307,8 @@ function pipelineStage( type, planoId, floorId, filterByStatus, filterByApproval
|
|
|
1307
1307
|
},
|
|
1308
1308
|
],
|
|
1309
1309
|
},
|
|
1310
|
-
|
|
1310
|
+
{ $ne: [ { $ifNull: [ '$FixtureData.fixtureName', null ] }, null ] },
|
|
1311
|
+
// { $gt: [ { $size: { $ifNull: [ '$FixtureData' ] } }, 0 ] },
|
|
1311
1312
|
// { $gt: [ { $size: { $ifNull: [ '$FixtureData.shelfConfig', [] ] } }, 0 ] },
|
|
1312
1313
|
],
|
|
1313
1314
|
},
|
|
@@ -5267,7 +5267,6 @@ export async function getRolloutTaskDetails( req, res ) {
|
|
|
5267
5267
|
taskId: { $last: '$_id' },
|
|
5268
5268
|
redoStatus: { $last: '$redoStatus' },
|
|
5269
5269
|
scheduleEndTime_iso: { $last: '$scheduleEndTime_iso' },
|
|
5270
|
-
taskId: { $last: '$_id' },
|
|
5271
5270
|
},
|
|
5272
5271
|
},
|
|
5273
5272
|
{
|
|
@@ -5288,287 +5287,45 @@ export async function getRolloutTaskDetails( req, res ) {
|
|
|
5288
5287
|
id: '$taskId',
|
|
5289
5288
|
breach: {
|
|
5290
5289
|
$cond: {
|
|
5291
|
-
if: {
|
|
5292
|
-
$gte: [ '$scheduleEndTime_iso', new Date() ],
|
|
5293
|
-
},
|
|
5290
|
+
if: { $gte: [ '$scheduleEndTime_iso', new Date() ] },
|
|
5294
5291
|
then: false,
|
|
5295
5292
|
else: true,
|
|
5296
5293
|
},
|
|
5297
5294
|
},
|
|
5298
5295
|
},
|
|
5299
5296
|
},
|
|
5300
|
-
taskIds: { $push: '$taskId' },
|
|
5301
5297
|
},
|
|
5302
5298
|
},
|
|
5299
|
+
// 🔹 Break out each task for lookup
|
|
5300
|
+
{ $unwind: '$taskStatus' },
|
|
5303
5301
|
{
|
|
5304
5302
|
$lookup: {
|
|
5305
5303
|
from: 'planotaskcompliances',
|
|
5306
5304
|
let: {
|
|
5307
|
-
task: '$
|
|
5305
|
+
task: '$taskStatus.id',
|
|
5306
|
+
type: '$taskStatus.type',
|
|
5308
5307
|
},
|
|
5309
5308
|
pipeline: [
|
|
5310
5309
|
{
|
|
5311
5310
|
$match: {
|
|
5312
5311
|
$expr: {
|
|
5313
5312
|
$and: [
|
|
5314
|
-
{ $eq: [ '$
|
|
5315
|
-
{ $eq: [ '$
|
|
5316
|
-
{ $in: [ '$taskId', '$$task' ] },
|
|
5317
|
-
// { $eq: [ '$status', 'incomplete' ] },
|
|
5318
|
-
{ $in: [ '$type', [ 'merchRollout', 'vmRollout' ] ] },
|
|
5313
|
+
{ $eq: [ '$taskId', '$$task' ] },
|
|
5314
|
+
{ $eq: [ '$type', '$$type' ] },
|
|
5319
5315
|
],
|
|
5320
5316
|
},
|
|
5321
5317
|
},
|
|
5322
5318
|
},
|
|
5323
5319
|
{ $sort: { _id: -1 } },
|
|
5324
|
-
{
|
|
5325
|
-
$set: {
|
|
5326
|
-
hasCompletedAnswers: {
|
|
5327
|
-
$anyElementTrue: {
|
|
5328
|
-
$map: {
|
|
5329
|
-
input: '$answers',
|
|
5330
|
-
as: 'ans',
|
|
5331
|
-
in: { $eq: [ '$$ans.status', null ] },
|
|
5332
|
-
},
|
|
5333
|
-
},
|
|
5334
|
-
},
|
|
5335
|
-
hasPendingIssues: {
|
|
5336
|
-
$anyElementTrue: {
|
|
5337
|
-
$map: {
|
|
5338
|
-
input: {
|
|
5339
|
-
$concatArrays: [
|
|
5340
|
-
{
|
|
5341
|
-
$reduce: {
|
|
5342
|
-
input: '$answers',
|
|
5343
|
-
initialValue: [],
|
|
5344
|
-
in: {
|
|
5345
|
-
$concatArrays: [
|
|
5346
|
-
'$$value',
|
|
5347
|
-
{
|
|
5348
|
-
$reduce: {
|
|
5349
|
-
input: { $ifNull: [ '$$this.issues', [] ] },
|
|
5350
|
-
initialValue: [],
|
|
5351
|
-
in: {
|
|
5352
|
-
$concatArrays: [
|
|
5353
|
-
'$$value',
|
|
5354
|
-
{ $ifNull: [ '$$this.Details', [] ] },
|
|
5355
|
-
],
|
|
5356
|
-
},
|
|
5357
|
-
},
|
|
5358
|
-
},
|
|
5359
|
-
],
|
|
5360
|
-
},
|
|
5361
|
-
},
|
|
5362
|
-
},
|
|
5363
|
-
],
|
|
5364
|
-
},
|
|
5365
|
-
as: 'detail',
|
|
5366
|
-
in: {
|
|
5367
|
-
$or: [ { $eq: [ '$$detail.status', 'pending' ] } ],
|
|
5368
|
-
},
|
|
5369
|
-
},
|
|
5370
|
-
},
|
|
5371
|
-
},
|
|
5372
|
-
hasDisagreeIssues: {
|
|
5373
|
-
$anyElementTrue: {
|
|
5374
|
-
$map: {
|
|
5375
|
-
input: {
|
|
5376
|
-
$concatArrays: [
|
|
5377
|
-
'$answers',
|
|
5378
|
-
{
|
|
5379
|
-
$reduce: {
|
|
5380
|
-
input: '$answers',
|
|
5381
|
-
initialValue: [],
|
|
5382
|
-
in: {
|
|
5383
|
-
$concatArrays: [
|
|
5384
|
-
'$$value',
|
|
5385
|
-
{
|
|
5386
|
-
$reduce: {
|
|
5387
|
-
input: { $ifNull: [ '$$this.issues', [] ] },
|
|
5388
|
-
initialValue: [],
|
|
5389
|
-
in: {
|
|
5390
|
-
$concatArrays: [
|
|
5391
|
-
'$$value',
|
|
5392
|
-
{ $ifNull: [ '$$this.Details', [] ] },
|
|
5393
|
-
],
|
|
5394
|
-
},
|
|
5395
|
-
},
|
|
5396
|
-
},
|
|
5397
|
-
],
|
|
5398
|
-
},
|
|
5399
|
-
},
|
|
5400
|
-
},
|
|
5401
|
-
],
|
|
5402
|
-
},
|
|
5403
|
-
as: 'detail',
|
|
5404
|
-
in: {
|
|
5405
|
-
$or: [ { $eq: [ '$$detail.status', 'disagree' ] } ],
|
|
5406
|
-
},
|
|
5407
|
-
},
|
|
5408
|
-
},
|
|
5409
|
-
},
|
|
5410
|
-
},
|
|
5411
|
-
},
|
|
5412
|
-
{
|
|
5413
|
-
$group: {
|
|
5414
|
-
_id: { taskId: '$taskId' },
|
|
5415
|
-
|
|
5416
|
-
// merch counters
|
|
5417
|
-
merchDisagree: {
|
|
5418
|
-
$sum: {
|
|
5419
|
-
$cond: [
|
|
5420
|
-
{ $and: [ { $eq: [ '$type', 'merchRollout' ] }, '$hasDisagreeIssues' ] },
|
|
5421
|
-
1,
|
|
5422
|
-
0,
|
|
5423
|
-
],
|
|
5424
|
-
},
|
|
5425
|
-
},
|
|
5426
|
-
merchPending: {
|
|
5427
|
-
$sum: {
|
|
5428
|
-
$cond: [
|
|
5429
|
-
{
|
|
5430
|
-
$and: [
|
|
5431
|
-
{ $eq: [ '$type', 'merchRollout' ] },
|
|
5432
|
-
{ $or: [ '$hasPendingIssues', '$hasCompletedAnswers' ] },
|
|
5433
|
-
],
|
|
5434
|
-
},
|
|
5435
|
-
1,
|
|
5436
|
-
0,
|
|
5437
|
-
],
|
|
5438
|
-
},
|
|
5439
|
-
},
|
|
5440
|
-
merchApproved: {
|
|
5441
|
-
$push: {
|
|
5442
|
-
$cond: [
|
|
5443
|
-
{
|
|
5444
|
-
$and: [
|
|
5445
|
-
{ $eq: [ '$type', 'merchRollout' ] },
|
|
5446
|
-
{ $eq: [ '$approvalStatus', 'approved' ] },
|
|
5447
|
-
],
|
|
5448
|
-
},
|
|
5449
|
-
'$approvalStatus',
|
|
5450
|
-
'$$REMOVE',
|
|
5451
|
-
],
|
|
5452
|
-
},
|
|
5453
|
-
},
|
|
5454
|
-
|
|
5455
|
-
// vm counters
|
|
5456
|
-
vmDisagree: {
|
|
5457
|
-
$sum: {
|
|
5458
|
-
$cond: [
|
|
5459
|
-
{ $and: [ { $eq: [ '$type', 'vmRollout' ] }, '$hasDisagreeIssues' ] },
|
|
5460
|
-
1,
|
|
5461
|
-
0,
|
|
5462
|
-
],
|
|
5463
|
-
},
|
|
5464
|
-
},
|
|
5465
|
-
vmPending: {
|
|
5466
|
-
$sum: {
|
|
5467
|
-
$cond: [
|
|
5468
|
-
{
|
|
5469
|
-
$and: [
|
|
5470
|
-
{ $eq: [ '$type', 'vmRollout' ] },
|
|
5471
|
-
{ $or: [ '$hasPendingIssues', '$hasCompletedAnswers' ] },
|
|
5472
|
-
],
|
|
5473
|
-
},
|
|
5474
|
-
1,
|
|
5475
|
-
0,
|
|
5476
|
-
],
|
|
5477
|
-
},
|
|
5478
|
-
},
|
|
5479
|
-
vmApproved: {
|
|
5480
|
-
$push: {
|
|
5481
|
-
$cond: [
|
|
5482
|
-
{
|
|
5483
|
-
$and: [
|
|
5484
|
-
{ $eq: [ '$type', 'vmRollout' ] },
|
|
5485
|
-
{ $eq: [ '$approvalStatus', 'approved' ] },
|
|
5486
|
-
],
|
|
5487
|
-
},
|
|
5488
|
-
'$approvalStatus',
|
|
5489
|
-
'$$REMOVE',
|
|
5490
|
-
],
|
|
5491
|
-
},
|
|
5492
|
-
},
|
|
5493
|
-
|
|
5494
|
-
// counts
|
|
5495
|
-
merchCount: {
|
|
5496
|
-
$sum: {
|
|
5497
|
-
$cond: [ { $eq: [ '$type', 'merchRollout' ] }, 1, 0 ],
|
|
5498
|
-
},
|
|
5499
|
-
},
|
|
5500
|
-
vmCount: {
|
|
5501
|
-
$sum: {
|
|
5502
|
-
$cond: [ { $eq: [ '$type', 'vmRollout' ] }, 1, 0 ],
|
|
5503
|
-
},
|
|
5504
|
-
},
|
|
5505
|
-
},
|
|
5506
|
-
},
|
|
5507
|
-
{
|
|
5508
|
-
$project: {
|
|
5509
|
-
_id: 0,
|
|
5510
|
-
merchStatus: {
|
|
5511
|
-
$switch: {
|
|
5512
|
-
branches: [
|
|
5513
|
-
{
|
|
5514
|
-
case: { $eq: [ '$merchCount', 0 ] },
|
|
5515
|
-
then: '',
|
|
5516
|
-
},
|
|
5517
|
-
{
|
|
5518
|
-
case: { $gt: [ '$merchPending', 0 ] },
|
|
5519
|
-
then: 'pending',
|
|
5520
|
-
},
|
|
5521
|
-
{
|
|
5522
|
-
case: { $gt: [ '$merchDisagree', 0 ] },
|
|
5523
|
-
then: 'disagree',
|
|
5524
|
-
},
|
|
5525
|
-
{
|
|
5526
|
-
case: {
|
|
5527
|
-
$and: [
|
|
5528
|
-
{ $eq: [ '$merchPending', 0 ] },
|
|
5529
|
-
{ $eq: [ '$merchDisagree', 0 ] },
|
|
5530
|
-
{ $eq: [ { $size: '$merchApproved' }, '$merchCount' ] },
|
|
5531
|
-
],
|
|
5532
|
-
},
|
|
5533
|
-
then: 'complete',
|
|
5534
|
-
},
|
|
5535
|
-
],
|
|
5536
|
-
default: 'pending',
|
|
5537
|
-
},
|
|
5538
|
-
},
|
|
5539
|
-
vmStatus: {
|
|
5540
|
-
$switch: {
|
|
5541
|
-
branches: [
|
|
5542
|
-
{
|
|
5543
|
-
case: { $eq: [ '$vmCount', 0 ] },
|
|
5544
|
-
then: '',
|
|
5545
|
-
},
|
|
5546
|
-
{
|
|
5547
|
-
case: { $gt: [ '$vmPending', 0 ] },
|
|
5548
|
-
then: 'pending',
|
|
5549
|
-
},
|
|
5550
|
-
{
|
|
5551
|
-
case: { $gt: [ '$vmDisagree', 0 ] },
|
|
5552
|
-
then: 'disagree',
|
|
5553
|
-
},
|
|
5554
|
-
{
|
|
5555
|
-
case: {
|
|
5556
|
-
$and: [
|
|
5557
|
-
{ $eq: [ '$vmPending', 0 ] },
|
|
5558
|
-
{ $eq: [ '$vmDisagree', 0 ] },
|
|
5559
|
-
{ $eq: [ { $size: '$vmApproved' }, '$vmCount' ] },
|
|
5560
|
-
],
|
|
5561
|
-
},
|
|
5562
|
-
then: 'complete',
|
|
5563
|
-
},
|
|
5564
|
-
],
|
|
5565
|
-
default: 'pending',
|
|
5566
|
-
},
|
|
5567
|
-
},
|
|
5568
|
-
},
|
|
5569
|
-
},
|
|
5570
5320
|
],
|
|
5571
|
-
as: 'taskDetails',
|
|
5321
|
+
as: 'taskStatus.taskDetails', // ✅ correctly attaches inside taskStatus
|
|
5322
|
+
},
|
|
5323
|
+
},
|
|
5324
|
+
// 🔹 Group back into array
|
|
5325
|
+
{
|
|
5326
|
+
$group: {
|
|
5327
|
+
_id: null,
|
|
5328
|
+
taskStatus: { $push: '$taskStatus' },
|
|
5572
5329
|
},
|
|
5573
5330
|
},
|
|
5574
5331
|
{
|
|
@@ -5591,30 +5348,80 @@ export async function getRolloutTaskDetails( req, res ) {
|
|
|
5591
5348
|
createdAt: '$$task.createdAt',
|
|
5592
5349
|
userName: '$$task.userName',
|
|
5593
5350
|
submitTime_string: '$$task.submitTime_string',
|
|
5594
|
-
|
|
5595
|
-
$switch: {
|
|
5596
|
-
branches: [
|
|
5597
|
-
{
|
|
5598
|
-
case: { $eq: [ '$$task.type', 'merchRollout' ] },
|
|
5599
|
-
then: { $arrayElemAt: [ '$taskDetails.merchStatus', 0 ] },
|
|
5600
|
-
},
|
|
5601
|
-
{
|
|
5602
|
-
case: { $eq: [ '$$task.type', 'vmRollout' ] },
|
|
5603
|
-
then: { $arrayElemAt: [ '$taskDetails.vmStatus', 0 ] },
|
|
5604
|
-
},
|
|
5605
|
-
],
|
|
5606
|
-
default: '',
|
|
5607
|
-
},
|
|
5608
|
-
},
|
|
5351
|
+
taskDetails: '$$task.taskDetails', // ✅ fixed reference
|
|
5609
5352
|
},
|
|
5610
5353
|
},
|
|
5611
5354
|
},
|
|
5612
5355
|
},
|
|
5613
5356
|
},
|
|
5614
|
-
|
|
5615
5357
|
];
|
|
5616
5358
|
|
|
5359
|
+
|
|
5617
5360
|
let taskInfo = await planotaskService.aggregate( query );
|
|
5361
|
+
let vmRolloutStatus ='';
|
|
5362
|
+
let merchRolloutStatus = '';
|
|
5363
|
+
if ( taskInfo.length ) {
|
|
5364
|
+
let merchPendingCount = 0;
|
|
5365
|
+
let merchDisagreeCount = 0;
|
|
5366
|
+
let vmPendingCount = 0;
|
|
5367
|
+
let vmDisagreeCount = 0;
|
|
5368
|
+
taskInfo?.[0]?.taskStatus.forEach( ( task ) => {
|
|
5369
|
+
if ( task.status == 'submit' ) {
|
|
5370
|
+
if ( task.type == 'merchRollout' ) {
|
|
5371
|
+
task.taskDetails.forEach( ( ele ) => {
|
|
5372
|
+
if ( ele.status == 'complete' && !ele?.answers?.[0]?.issues.length ) {
|
|
5373
|
+
if ( !ele?.answers?.[0]?.status ) {
|
|
5374
|
+
merchPendingCount++;
|
|
5375
|
+
}
|
|
5376
|
+
if ( ele?.answers?.[0]?.status == 'disagree' ) {
|
|
5377
|
+
merchDisagreeCount++;
|
|
5378
|
+
}
|
|
5379
|
+
} else {
|
|
5380
|
+
ele?.answers.forEach( ( ans ) => {
|
|
5381
|
+
ans.issues.forEach( ( iss ) => {
|
|
5382
|
+
iss.Details.forEach( ( det ) => {
|
|
5383
|
+
if ( det.status == 'pending' ) {
|
|
5384
|
+
merchPendingCount++;
|
|
5385
|
+
}
|
|
5386
|
+
if ( det.status == 'disagree' ) {
|
|
5387
|
+
merchDisagreeCount++;
|
|
5388
|
+
}
|
|
5389
|
+
} );
|
|
5390
|
+
} );
|
|
5391
|
+
} );
|
|
5392
|
+
}
|
|
5393
|
+
} );
|
|
5394
|
+
merchRolloutStatus = merchPendingCount ? 'pending' : merchDisagreeCount ? 'disagree' : task.taskDetails?.length ? 'complete' : '';
|
|
5395
|
+
} else {
|
|
5396
|
+
task.taskDetails.forEach( ( ele ) => {
|
|
5397
|
+
if ( ele.status == 'complete' && !ele?.answers?.[0]?.issues.length ) {
|
|
5398
|
+
if ( !ele?.answers?.[0]?.status ) {
|
|
5399
|
+
vmPendingCount++;
|
|
5400
|
+
}
|
|
5401
|
+
if ( ele?.answers?.[0]?.status == 'disagree' ) {
|
|
5402
|
+
vmDisagreeCount++;
|
|
5403
|
+
}
|
|
5404
|
+
} else {
|
|
5405
|
+
ele?.answers.forEach( ( ans ) => {
|
|
5406
|
+
ans.issues.forEach( ( iss ) => {
|
|
5407
|
+
iss.Details.forEach( ( det ) => {
|
|
5408
|
+
if ( det.status == 'pending' ) {
|
|
5409
|
+
vmPendingCount++;
|
|
5410
|
+
}
|
|
5411
|
+
if ( det.status == 'disagree' ) {
|
|
5412
|
+
vmDisagreeCount++;
|
|
5413
|
+
}
|
|
5414
|
+
} );
|
|
5415
|
+
} );
|
|
5416
|
+
} );
|
|
5417
|
+
}
|
|
5418
|
+
} );
|
|
5419
|
+
vmRolloutStatus = vmPendingCount ? 'pending' : vmDisagreeCount ? 'disagree' : task.taskDetails?.length ? 'complete' : '';
|
|
5420
|
+
}
|
|
5421
|
+
}
|
|
5422
|
+
task.feedbackStatus = task.type == 'vmRollout' ? vmRolloutStatus : merchRolloutStatus;
|
|
5423
|
+
} );
|
|
5424
|
+
}
|
|
5618
5425
|
const [ merchCount, vmCount ] = await Promise.all( [
|
|
5619
5426
|
await storeFixtureService.count( { floorId: req.query.floorId, isMerchEdited: true } ),
|
|
5620
5427
|
await storeFixtureService.count( { floorId: req.query.floorId, isVmEdited: true } ),
|