Skip to content

Commit 02d7197

Browse files
author
Vikas Agarwal
committed
Fixing logic of finding the project template for upgrade from v2 to v3
1 parent 15bba39 commit 02d7197

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/routes/projectUpgrade/create.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ async function migrateFromV2ToV3(req, project, defaultProductTemplateId, phaseNa
7575
await models.sequelize.transaction(async (transaction) => {
7676
const products = project.details.products;
7777
const projectTemplate = await models.ProjectTemplate.find({
78-
where: { key: project.type },
78+
where: { key: products[0] },
7979
attributes: ['id', 'phases'],
8080
raw: true,
8181
transaction,

src/routes/projectUpgrade/create.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe('Project upgrade', () => {
5252
});
5353
projectTemplate = await models.ProjectTemplate.create({
5454
name: 'template 1',
55-
key: project.type,
55+
key: project.details.products[0],
5656
category: 'category 1',
5757
icon: 'http://example.com/icon1.ico',
5858
question: 'question 1',

0 commit comments

Comments
 (0)