Skip to content

Commit

Permalink
Merge pull request #66 from shikshalokam/master
Browse files Browse the repository at this point in the history
user solution fix
  • Loading branch information
aks30 authored Mar 9, 2022
2 parents e35ab4d + 201b2a4 commit 45782c0
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions module/users/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,7 @@ module.exports = class UsersHelper {
  return solution.referenceFrom == constants.common.PROJECT && solution.type == constants.common.OBSERVATION;
});

totalCount = autoTargetedSolutions.data.data.count;

totalCount = autoTargetedSolutions.data.data.length;
mergedData = autoTargetedSolutions.data.data;

mergedData = mergedData.map((targetedData, index) => {
Expand All @@ -476,10 +475,22 @@ module.exports = class UsersHelper {
// Add projectId to the solution object if the user has already started a project for the improvement project solution.
if (importedProjects.success) {
if (importedProjects.data && importedProjects.data.length > 0) {

importedProjects.data.forEach((importedProject) => {
if(projectSolutionIdIndexMap[importedProject.solutionInformation._id]) {

if( projectSolutionIdIndexMap[importedProject.solutionInformation._id] ) {
mergedData[projectSolutionIdIndexMap[importedProject.solutionInformation._id]].projectId = importedProject._id;
} else {

let data = importedProject.solutionInformation;
data['projectTemplateId'] = importedProject.projectTemplateId;
data['projectId'] = importedProject._id;
data["type"] = constants.common.IMPROVEMENT_PROJECT;
mergedData.push(data);
totalCount = totalCount + 1;

}

});
}
}
Expand Down

0 comments on commit 45782c0

Please sign in to comment.