GWM
This commit is contained in:
parent
cd30aa0d76
commit
4b0155106f
@ -348,10 +348,26 @@ exports.updatePolicyMasterData = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Vanilla = await DscrLeverageGrid.findAll({raw:true,where:{program_id : 1}, include:[{ model: ProgramMaster,attributes:['program_name'] },{ model: BusinessActivityMaster,attributes:['business_activity_name'] }] });
|
||||
OtherThenVanilla = await DscrLeverageGrid.findAll({raw:true,where:{program_id : 8}, include:[{ model: ProgramMaster,attributes:['program_name'] },{ model: BusinessActivityMaster,attributes:['business_activity_name'] }] });
|
||||
|
||||
data = {Vanilla : Vanilla , OtherThenVanilla : OtherThenVanilla};
|
||||
VanillaArray = [];
|
||||
OtherThenVanillaArray = [];
|
||||
data = [ { program : "Vanilla" , child : VanillaArray } , { program : "OtherThenVanilla" , child : OtherThenVanillaArray}];
|
||||
|
||||
groupByData = await DscrLeverageGrid.findAll({attributes:['program_id','business_activity_id'],group: ["program_id","business_activity_id"] });
|
||||
for(const groupByDataValue of groupByData)
|
||||
{
|
||||
if(groupByDataValue.program_id == 1 )
|
||||
{
|
||||
VanillaData = await DscrLeverageGrid.findAll({raw:true,where:{program_id : 1 ,business_activity_id : groupByDataValue.business_activity_id }, include:[{ model: ProgramMaster,attributes:['program_name'] },{ model: BusinessActivityMaster,attributes:['business_activity_name'] }] });
|
||||
VanillaArray.push(VanillaData);
|
||||
}
|
||||
else{
|
||||
OtherThenVanillaData = await DscrLeverageGrid.findAll({raw:true,where:{program_id : 8,business_activity_id : groupByDataValue.business_activity_id}, include:[{ model: ProgramMaster,attributes:['program_name'] },{ model: BusinessActivityMaster,attributes:['business_activity_name'] }] });
|
||||
OtherThenVanillaArray.push(OtherThenVanillaData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user