Skip to content

Conversation

@hentrymartin
Copy link
Collaborator

What's in this PR?

  • When a new reviewer config is added, the existing reviewer assigned to review type was removed
  • This is now fixed.

Ticket link - https://topcoder.atlassian.net/browse/PM-3270

updateAssignedMembers (challengeResources, challenge, prevChallenge = null) {
const reviewersWithPhaseName = challenge.reviewers.map(item => {
const phase = challenge.phases && challenge.phases.find(p => p.phaseId === item.phaseId)
const phase = challenge.phases && challenge.phases.find(p => (p.id === item.phaseId) || (p.phaseId === item.phaseId))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[💡 maintainability]
The condition (p.id === item.phaseId) || (p.phaseId === item.phaseId) might be redundant if p.id and p.phaseId are always the same. Ensure that both properties are necessary and distinct. If not, consider simplifying the condition.

if (prevChallenge && prevChallenge.reviewers) {
const prevReviewers = prevChallenge.reviewers || []
challenge.reviewers.forEach((reviewer, index) => {
const prevReviewer = prevReviewers[index]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The logic assumes that prevReviewers and challenge.reviewers have the same order and length. If this assumption is not guaranteed, it could lead to incorrect behavior. Consider using a more robust matching strategy, such as matching by a unique identifier.

Object.keys(assignedMembers).forEach(indexStr => {
const index = parseInt(indexStr, 10)
const reviewer = challenge.reviewers[index]
if (index >= challenge.reviewers.length ||
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[💡 readability]
The condition index >= challenge.reviewers.length is redundant because index is derived from Object.keys(assignedMembers), which should not exceed the length of challenge.reviewers. Consider removing this check for clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants