Skip to content

Commit cf04b48

Browse files
author
Vikas Agarwal
committed
mapping in_review to draft for project status while upgrading old projects
added debug logs for admin index endpoint
1 parent 1067064 commit cf04b48

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/routes/admin/project-index-create.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ module.exports = [
5757
if (!project) {
5858
return Promise.resolve(null);
5959
}
60+
logger.debug('phases', project.phases)
6061
if (project.phases) {
6162
// removs the delete audit fields from the index data
6263
project.phases = project.phases.map(phase => _.omit(phase, ['deletedAt', 'deletedBy']));

src/routes/projectUpgrade/create.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,17 @@ async function migrateFromV2ToV3(req, project, defaultProductTemplateId, phaseNa
104104
const endDate = projectCompleted
105105
? (await findCompletedProjectEndDate(project.id, transaction)) || project.updatedAt
106106
: null;
107+
let phaseStatus = project.status;
108+
// maps the in_review status to the draft status for the phase
109+
phaseStatus = phaseStatus === PROJECT_STATUS.IN_REVIEW ? PROJECT_STATUS.DRAFT : phaseStatus;
107110
const projectPhase = await models.ProjectPhase.create({
108111
projectId: project.id,
109112
// TODO: there should be a clear requirement about how to set the phase's name without relying on its
110113
// products, as they are multiple, and this needs a single value
111114
// setting the name that was on the original phase's object, as is the most promising/obvious way of doing
112115
// this
113116
name: phaseName || phaseObject.name || '',
114-
status: project.status,
117+
status: phaseStatus,
115118
startDate: project.createdAt,
116119
endDate,
117120
budget: project.details && project.details.appDefinition && project.details.appDefinition.budget,

0 commit comments

Comments
 (0)