Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/job-roles-group-name-typo #6393

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions backend/migrations/20241023113359-fixTypoInJobGroupName.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict';

const table = {
tableName: 'Job',
schema: 'cqc',
};

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
return queryInterface.sequelize.transaction(async (transaction) => {
queryInterface
.removeColumn(table, 'JobRoleGroup', transaction)
.then(async () => {
await queryInterface.sequelize.query('DROP TYPE IF EXISTS cqc."enum_Job_JobRoleGroup";', transaction);
})
.then(async () => {
await queryInterface.addColumn(table, 'JobRoleGroup', {
type: Sequelize.DataTypes.ENUM,
values: [
'Care providing roles',
'Professional and related roles',
'Managerial and supervisory roles',
'IT, digital and data roles',
'Other roles',
],
transaction,
});
});
});
},

async down(queryInterface) {},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'use strict';
const models = require('../server/models/index');

const jobRoleGroups = {
['Care providing roles']: [25, 10, 11, 20, 39],
['Professional and related roles']: [27, 18, 23, 4, 19, 17, 16],
['Managerial and supervisory roles']: [26, 15, 13, 22, 28, 14, 30, 32],
['IT, digital and data roles']: [33, 34, 35, 36, 37, 38],
['Other roles']: [12, 3, 2, 5, 21, 1, 24, 7, 8, 6, 31],
};

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
return queryInterface.sequelize.transaction(async (transaction) => {
for (let key of Object.keys(jobRoleGroups)) {
await models.job.update(
{
jobRoleGroup: key,
},
{
where: {
id: { [Sequelize.Op.in]: jobRoleGroups[key] },
},
},
{ transaction },
);
}
});
},

async down(queryInterface, Sequelize) {
return queryInterface.sequelize.transaction(async (transaction) => {
await models.job.update(
{
jobRoleGroup: null,
},
{
where: {
jobRoleGroup: {
[Sequelize.Op.ne]: null,
},
},
},
{ transaction },
);
});
},
};
6 changes: 3 additions & 3 deletions backend/server/models/job.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* jshint indent: 2 */

const { timeStamp } = require("console");
const { timeStamp } = require('console');

module.exports = function (sequelize, DataTypes) {
const Job = sequelize.define(
Expand Down Expand Up @@ -34,11 +34,11 @@ module.exports = function (sequelize, DataTypes) {
'Care providing roles',
'Professional and related roles',
'Managerial and supervisory roles',
'IT, digital and date roles',
'IT, digital and data roles',
'Other roles',
],
field: 'JobRoleGroup',
}
},
},
{
tableName: '"Job"',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class MainJobRoleComponent extends QuestionComponent implements OnInit, O
'Care providing roles': 'care worker, community support, support worker',
'Professional and related roles': 'occupational therapist, registered nurse, nursing assistant',
'Managerial and supervisory roles': 'registered manager, supervisor, team leader',
'IT, digital and date roles': 'data analyst, IT and digital support, IT manager',
'IT, digital and data roles': 'data analyst, IT and digital support, IT manager',
'Other roles': 'admin, care co-ordinator, learning and development',
};

Expand Down
Loading