Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- results = [
- {id: 1, test: biology, candidates:[ {cid: 11},{cid: 12},{cid: 13}]},
- {id: 2, test: chemistry, candidates:[ {cid: 15},{cid: 16},{cid: 17}]},
- {id: 3, test: physics, candidates:[ {cid: 1},{cid: 6},{cid: 7}]}
- ];
- var new_Result = results.map( function (subject) {
- let promises = [];
- if (subject.candidates && subject.candidates.length > 0)
- {
- subject.candidates.forEach( (element) => {
- promises.push(mobileUtil. getTotalMarksPerCandidate(element));
- });
- }
- return Promise.all(promises).then( result => {
- console.log('Check this out', result);
- subject.newCandidatelist = result;
- return subject;
- });
- });
- console.log('R: ', new_Result);
- resolve(params);
- Thank you
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement