Skip to content

Commit 55bc7bf

Browse files
author
Vikas Agarwal
committed
fix: git#892-Thomas' Review of Process
- Now validating the task assignment from the presence of Submitter resource instead of looking at `task.memberId` field as per the suggestions feat: git#896-Remove copilot and copilot fee validation for a task close
1 parent 4cd7bc4 commit 55bc7bf

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

src/components/ChallengeEditor/index.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,7 @@ class ChallengeEditor extends Component {
10311031
return <div>Error loading challenge</div>
10321032
}
10331033
const isTask = _.get(challenge, 'task.isTask', false)
1034+
console.log(this.props.assignedMemberDetails)
10341035
const { assignedMemberDetails, error } = this.state
10351036
let isActive = false
10361037
let isDraft = false
@@ -1098,33 +1099,22 @@ class ChallengeEditor extends Component {
10981099
*/
10991100
if (isCloseTask && !isConfirm) {
11001101
const taskPrize = _.get(_.find(challenge.prizeSets, { type: 'placement' }), 'prizes[0].value')
1101-
const assignedMember = assignedMemberDetails ? assignedMemberDetails.handle : `User id: ${_.get(challenge, 'task.memberId')}`
1102-
const copilotFee = _.get(_.find(challenge.prizeSets, { type: 'copilot' }), 'prizes[0].value')
1103-
const copilot = challenge.copilot
1102+
const assignedMemberId = _.get(assignedMemberDetails, 'userId')
1103+
const assignedMember = _.get(assignedMemberDetails, 'handle', `User Id: ${assignedMemberId}`)
11041104

11051105
const validationErrors = []
1106-
if (!_.get(challenge, 'task.memberId')) {
1106+
if (!assignedMemberId) {
11071107
validationErrors.push('assign task member')
11081108
}
11091109

1110-
if (!copilot) {
1111-
validationErrors.push('select copilot')
1112-
}
1113-
1114-
if (!copilotFee) {
1115-
validationErrors.push('set copilot fee')
1116-
}
1117-
11181110
// if all data for closing task is there, show confirmation modal
11191111
if (validationErrors.length === 0) {
11201112
closeTaskModal = (
11211113
<ConfirmationModal
11221114
title='Close Task Confirmation'
11231115
message={
11241116
<p>
1125-
Are you sure want to close task <strong>"{challenge.name}"</strong> with the prize <strong>${taskPrize}</strong> for <strong>{assignedMember}</strong>
1126-
{' '}
1127-
and copilot fee <strong>${copilotFee}</strong> for <strong>{copilot}</strong>?
1117+
Are you sure want to close task <strong>"{challenge.name}"</strong> with the prize <strong>${taskPrize}</strong> for <strong>{assignedMember}</strong>?
11281118
</p>
11291119
}
11301120
theme={theme}

0 commit comments

Comments
 (0)