Skip to content

Fix merge conficts with dev #380

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

Merged
merged 7 commits into from
Jun 23, 2021
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ install_dependency: &install_dependency
install_deploysuite: &install_deploysuite
name: Installation of install_deploysuite.
command: |
git clone --branch v1.4.6 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
git clone --branch master https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
cp ./../buildscript/master_deploy.sh .
cp ./../buildscript/buildenv.sh .
cp ./../buildscript/awsconfiguration.sh .
Expand Down
22 changes: 11 additions & 11 deletions data/demo-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -7646,10 +7646,10 @@
"name": "Angular Developer",
"description": "* Writes tested and documented JavaScript, HTML and CSS\n* Makes design and technical decisions for AngularJS projects\n* Develops application code and unit test in the AngularJS, Rest Web Services and Java technologies",
"listOfSkills": [
"database",
"winforms",
"user interface (ui)",
"photoshop"
"Database",
"Winforms",
"User Interface (Ui)",
"Photoshop"
],
"rates": [
{
Expand Down Expand Up @@ -7678,10 +7678,10 @@
"name": "Dev Ops Engineer",
"description": "* Introduces processes, tools, and methodologies\n* Balances needs throughout the software development life cycle\n* Configures server images, optimizes task performance in correspondence with engineers",
"listOfSkills": [
"dropwizard",
"nginx",
"machine learning",
"force.com"
"Dropwizard",
"NGINX",
"Machine Learning",
"Force.com"
],
"rates": [
{
Expand Down Expand Up @@ -7722,10 +7722,10 @@
"name": "Salesforce Developer",
"description": "* Meets with project managers to determine CRM needs\n* Develops customized solutions within the Salesforce platform\n* Designs, codes, and implements Salesforce applications\n* Creates timelines and development goals\n* Tests the stability and functionality of the application\n* Troubleshoots and fixes bugs\n* Writes documents and provides technical training for Salesforce Staff\n* Maintains the security and integrity of the application software",
"listOfSkills": [
"docker",
".net",
"Docker",
".NET",
"appcelerator",
"flux"
"Flux"
],
"rates": [
{
Expand Down
15 changes: 15 additions & 0 deletions migrations/2021-06-18-make-payment-scheduler-step-optional.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const config = require('config')
const _ = require('lodash')
const { PaymentSchedulerStatus } = require('../app-constants')
/*
* Make Job payment_schedulers step optional.
*/

module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.sequelize.query(`ALTER TABLE ${config.DB_SCHEMA_NAME}.payment_schedulers ALTER COLUMN step DROP NOT NULL`)
},
down: async (queryInterface, Sequelize) => {
await queryInterface.sequelize.query(`ALTER TABLE ${config.DB_SCHEMA_NAME}.payment_schedulers ALTER COLUMN step SET NOT NULL`)
}
}
8 changes: 8 additions & 0 deletions scripts/demo-payment-scheduler/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
"startDate":"2020-09-27",
"endDate":"2020-10-03",
"daysWorked":4,
"daysPaid": 3,
"paymentTotal": 0,
"memberRate":27.06,
"customerRate":13.13,
"paymentStatus":"partially-completed",
Expand All @@ -59,6 +61,8 @@
"startDate":"2020-10-18",
"endDate":"2020-10-24",
"daysWorked":4,
"daysPaid": 3,
"paymentTotal": 0,
"memberRate":4.08,
"customerRate":3.89,
"paymentStatus":"cancelled",
Expand All @@ -75,6 +79,8 @@
"startDate":"2020-10-25",
"endDate":"2020-10-31",
"daysWorked":3,
"daysPaid": 3,
"paymentTotal": 0,
"memberRate":15.61,
"customerRate":9.76,
"paymentStatus":"pending",
Expand All @@ -91,6 +97,8 @@
"startDate":"2020-10-11",
"endDate":"2020-10-17",
"daysWorked":4,
"daysPaid": 3,
"paymentTotal": 0,
"memberRate":10.82,
"customerRate":30.71,
"paymentStatus":"pending",
Expand Down
2 changes: 2 additions & 0 deletions scripts/demo-payment-scheduler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ for (let i = 0; i < 1000; i++) {
amount: _.round(_.random(1000, true), 2),
status: 'scheduled',
billingAccountId: data.ResourceBooking.billingAccountId,
memberRate: data.ResourceBooking.memberRate,
days: 4,
createdBy: '57646ff9-1cd3-4d3c-88ba-eb09a395366c',
updatedBy: null,
createdAt: `2021-05-19T21:3${i % 10}:46.507Z`,
Expand Down
3 changes: 1 addition & 2 deletions src/models/PaymentScheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ module.exports = (sequelize) => {
allowNull: false
},
step: {
type: Sequelize.ENUM(_.values(PaymentSchedulerStatus)),
allowNull: false
type: Sequelize.ENUM(_.values(PaymentSchedulerStatus))
},
status: {
type: Sequelize.ENUM(
Expand Down
2 changes: 1 addition & 1 deletion src/services/PaymentSchedulerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async function processPayment (workPeriodPayment) {
await postEvent(config.TAAS_WORK_PERIOD_PAYMENT_UPDATE_TOPIC, updated.toJSON(), { oldValue })

if (paymentScheduler) {
await paymentScheduler.update({ step: PaymentSchedulerStatus.CLOSE_CHALLENGE, userId: paymentScheduler.userId, status: 'failed' })
await paymentScheduler.update({ step: _.get(err, 'step'), userId: paymentScheduler.userId, status: 'failed' })
}
localLogger.error(`Processed workPeriodPayment ${workPeriodPayment.id} failed`, 'processPayment')
return processResult.FAIL
Expand Down
26 changes: 6 additions & 20 deletions src/services/TeamService.js
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ async function roleSearchRequest (currentUser, data) {
if (!_.isUndefined(data.roleId)) {
role = await Role.findById(data.roleId)
role = role.toJSON()
role.skillsMatch = 1;
role.skillsMatch = 1
// if skills is provided then use skills to find role
} else if (!_.isUndefined(data.skills)) {
// validate given skillIds and convert them into skill names
Expand Down Expand Up @@ -802,30 +802,16 @@ roleSearchRequest.schema = Joi.object()
* @returns {Role} the best matching Role
*/
async function getRoleBySkills (skills) {
// Case-insensitive search for roles matching any of the given skills
const lowerCaseSkills = skills.map(skill => skill.toLowerCase())
// find all roles which includes any of the given skills
const queryCriteria = {
where: where(
fn(
'string_to_array',
fn(
'lower',
fn(
'array_to_string',
col('list_of_skills'),
','
)
),
','
),
{[Op.overlap]: lowerCaseSkills }),
where: { listOfSkills: { [Op.overlap]: skills } },
raw: true
}
const roles = await Role.findAll(queryCriteria)
if (roles.length > 0) {
let result = _.each(roles, role => {
// calculate each found roles matching rate (must again be made case-insensitive)
role.skillsMatch = _.intersection(role.listOfSkills.map(skill => skill.toLowerCase()), lowerCaseSkills).length / skills.length
// calculate each found roles matching rate
role.skillsMatch = _.intersection(role.listOfSkills, skills).length / skills.length
// each role can have multiple rates, get the maximum of global rates
role.maxGlobal = _.maxBy(role.rates, 'global').global
})
Expand All @@ -837,7 +823,7 @@ async function getRoleBySkills (skills) {
}
}
// if no matching role found then return Custom role or empty object
return await Role.findOne({ where: { name: { [Op.iLike]: 'Custom' } } }) || {}
return await Role.findOne({ where: { name: { [Op.iLike]: 'Custom' } }, raw: true }) || {}
}

getRoleBySkills.schema = Joi.object()
Expand Down