Skip to content

Conversation

@ocielliottc
Copy link
Collaborator

This was more complicated than I expected. With these changes, we can now view open review periods. Managers can see the status of reviews and can view submitted self-reviews and reviews of their subordinates.

@ocielliottc ocielliottc linked an issue Sep 25, 2024 that may be closed by this pull request
setAssignments(assignments.filter(a =>
!(a.revieweeId === revieweeId && a.reviewerId === reviewerId)));
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

const { id, revieweeId, reviewerId } = assignment;

if (id) {
  try {
    const res = await resolve({
      method: 'DELETE',
      url: `${reviewAssignmentsUrl}/${id}`,
      headers: { 'X-CSRF-Header': csrf }
    });
    
    if (res.error) {
      console.error('Error deleting assignment:', res.error);
      return;
    }
    
    // Update state by removing the assignment by id
    setAssignments(prevAssignments => prevAssignments.filter(a => a.id !== id));
    
  } catch (error) {
    console.error('Request failed:', error);
  }
} else {
  // If there's no id, remove by matching revieweeId and reviewerId
  setAssignments(prevAssignments =>
    prevAssignments.filter(a => !(a.revieweeId === revieweeId && a.reviewerId === reviewerId))
  );
}

Copy link
Contributor

@thelenw thelenw left a comment

Choose a reason for hiding this comment

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

Comments with code blocks, and without text, are recommended refactors.

@mkimberlin mkimberlin merged commit 4eb5d5b into develop Sep 27, 2024
@mkimberlin mkimberlin deleted the feature-2550/rewire-review-page branch September 27, 2024 18:30
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.

Rewire old review page

4 participants