Skip to content

Conversation

rishabhtc
Copy link
Collaborator

No description provided.


// Reload default reviewers if challenge type or track changed
if (challenge && prevChallenge &&
(challenge.typeId !== prevChallenge.typeId || challenge.trackId !== prevChallenge.trackId)) {

Choose a reason for hiding this comment

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

Consider consolidating the conditions in the if statements on lines 36 and 42, as they both check for changes in challenge.type and challenge.track. This could help reduce redundancy and improve readability.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

one is type and other is typeId so not required

)
const firstReviewPhase = reviewPhases && reviewPhases.length > 0 ? reviewPhases[0] : null

const isAIReviewer = (defaultReviewer && defaultReviewer.isAIReviewer) || false

Choose a reason for hiding this comment

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

The variable isAIReviewer is defined but not used until line 98. Consider moving its declaration closer to its usage to improve readability.

scorecardId: (defaultReviewer && defaultReviewer.scorecardId) || '',
isMemberReview: true,
memberReviewerCount: (defaultReviewer && defaultReviewer.memberReviewerCount) || 1,
isMemberReview: !isAIReviewer,

Choose a reason for hiding this comment

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

The logic for determining isMemberReview has changed from always being true to being dependent on isAIReviewer. Ensure that this change aligns with the intended functionality and does not introduce any unintended behavior.


// Only include memberReviewerCount for member reviewers
if (!isAIReviewer) {
newReviewer.memberReviewerCount = (defaultReviewer && defaultReviewer.memberReviewerCount) || 1

Choose a reason for hiding this comment

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

The condition for setting memberReviewerCount has changed to only apply when isAIReviewer is false. Verify that this logic is correct and that memberReviewerCount should indeed be excluded for AI reviewers.

// Maintain correct field order as expected by API schema
const currentReviewer = updatedReviewers[index]
updatedReviewers[index] = {
const updatedReviewer = {

Choose a reason for hiding this comment

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

The variable updatedReviewer is declared but not used. Consider using it to update updatedReviewers[index] or remove it if it's unnecessary.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it is used on line 292


// Only include memberReviewerCount for member reviewers
if (!isAI) {
updatedReviewer.memberReviewerCount = currentReviewer.memberReviewerCount || 1

Choose a reason for hiding this comment

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

Consider checking if currentReviewer.memberReviewerCount is a valid number before using it, to prevent potential issues with unexpected values.

.filter(phase => {
const isReviewPhase = phase.name && phase.name.toLowerCase().includes('review')
const phaseName = phase.name ? phase.name.toLowerCase() : ''
const isReviewPhase = phaseName.includes('review')

Choose a reason for hiding this comment

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

Consider using toLowerCase() only once for phase.name to improve performance and readability. You can store the result in a variable and use it for both isReviewPhase and isSubmissionPhase checks.

// For AI reviewers, allow both review and submission phases
// For member reviewers, only allow review phases
if (reviewer.isAIReviewer) {
return (isReviewPhase || isSubmissionPhase) || isCurrentlySelected

Choose a reason for hiding this comment

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

The condition (isReviewPhase || isSubmissionPhase) || isCurrentlySelected can be simplified to isReviewPhase || isSubmissionPhase || isCurrentlySelected.

@rishabhtc rishabhtc changed the title Fixed minor bugs PM-1833 Fixed minor bugs Sep 16, 2025
@rishabhtc rishabhtc changed the title PM-1833 Fixed minor bugs PM-1833 & PM-1939 - Update Review Configuration UI Sep 18, 2025
Copy link
Collaborator

@vas3a vas3a left a comment

Choose a reason for hiding this comment

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

looks mostly good. the code will need a bit of refactor, but we can loop on it later on.

{readOnly ? (
<span>
{(() => {
const typeMap = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this map either already exists somewhere, or you have to create it in a config/constants file. this is bad practice (to create it in the render function, it gets recreated a log of times).

@jmgasper jmgasper merged commit 469a67d into v6 Sep 18, 2025
1 check passed
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.

3 participants