Skip to content

Commit 0609806

Browse files
author
vikasrohit
authored
Merge pull request #3007 from appirio-tech/hotfix/fixing_timing_issue_with_project_creation
Hotfix/fixing timing issue with project creation
2 parents 5cba6a9 + 7c19adb commit 0609806

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/projects/actions/project.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,10 @@ export function createProject(newProject) {
203203
*
204204
* @returns {Promise<[]>} list of products
205205
*/
206-
function getAllProjectProducts(project) {
207-
return getProjectPhasesWithProducts(project.id)
208-
.then((phases) => _.flatten(_.map(phases, 'products')))
209-
}
206+
// function getAllProjectProducts(project, fromDB = false) {
207+
// return getProjectPhasesWithProducts(project.id, fromDB)
208+
// .then((phases) => _.flatten(_.map(phases, 'products')))
209+
// }
210210

211211
/**
212212
* Create timeline and milestones for a product
@@ -235,11 +235,12 @@ function createTimelineAndMilestoneForProduct(product, phase) {
235235
* @returns {Promise} project
236236
*/
237237
function createProductsTimelineAndMilestone(project) {
238-
return getAllProjectProducts(project)
239-
.then((products) =>
240-
Promise.all(products.map(createTimelineAndMilestoneForProduct))
241-
)
242-
.then(() => project)
238+
if (project.phases) {
239+
const products = _.flatten(_.map(project.phases, 'products'))
240+
return Promise.all(products.map(createTimelineAndMilestoneForProduct)).then(() => project)
241+
} else {
242+
console.log('We did not receive the phases for the project. Hence timeline and milestones are not created')
243+
}
243244
}
244245

245246
export function createProduct(project, productTemplate, phases, timelines) {

0 commit comments

Comments
 (0)