Skip to content
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

Update team table so that duplicate team members cannot be added #1551

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

roseeichelmann
Copy link
Contributor

@roseeichelmann roseeichelmann commented Feb 28, 2025

Associated issues

Closes cityofaustin/atd-data-tech#21199

Even though theres minimal code changes i found this to be way more complicated to untangle/implement than i thought it would!

Testing

URL to test:
https://deploy-preview-1551--atd-moped-main.netlify.app/moped/

Steps to test:

  1. Test adding new members to a team table. You shouldnt be able to add members that are already on the team, they shouldnt be an option
  2. Edit a team member row. You shouldnt see options for members that are already on the team, but you should be able to click on a diff member and then click back to the original member of the row before you edited it and save that, therefore not really updating anything.
  3. Test deleting members, updating, adding fields, etc try to break something!
  4. See that the [object Object] on the workgroup field is no longer showing when saving new team member edits

Ship list

@roseeichelmann roseeichelmann added the WIP Work in progress label Feb 28, 2025
value: { workgroup_id: newValue?.workgroup_id },
value: {
workgroup_id: newValue?.workgroup_id,
workgroup_name: workgroupLookup[newValue?.workgroup_id],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this fixed a bug thats currently in prod where if you edit a row and click a new user and then in the same edit session click the old user again and save that, you would see [object Object] in the workgroup name field. also in other cases where you are actually saving a new user, [object Object] would just flash on the screen in the time between clicking save and this hook running which manually adds the workgroup_name to the row data

Copy link
Collaborator

@mddilley mddilley Mar 4, 2025

Choose a reason for hiding this comment

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

Nice! Thank you for catching AND fixing this bug. 🚀 I was able to see the native object peek out in staging when I adjusted my connection speed. 🙏

FYI @chiaberry this probably affects your work on reusable autocompletes that have dependent fields

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for addressing this bug! I am going to check the milestones table to see if I see that same bug there.

Copy link
Collaborator

@mddilley mddilley left a comment

Choose a reason for hiding this comment

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

Looks great! I tested adding, editing, and deleting team members, and I can no longer add the same person over and over. Thanks for bundling in a bug fix too. Great find! 🙏

I left some comments about code that I'd like to get your feedback on, but this is 🚢 based on functionality. 🙌

value: { workgroup_id: newValue?.workgroup_id },
value: {
workgroup_id: newValue?.workgroup_id,
workgroup_name: workgroupLookup[newValue?.workgroup_id],
Copy link
Collaborator

@mddilley mddilley Mar 4, 2025

Choose a reason for hiding this comment

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

Nice! Thank you for catching AND fixing this bug. 🚀 I was able to see the native object peek out in staging when I adjusted my connection speed. 🙏

FYI @chiaberry this probably affects your work on reusable autocompletes that have dependent fields

@roseeichelmann roseeichelmann requested a review from mddilley March 4, 2025 21:40
@roseeichelmann
Copy link
Contributor Author

thanks for your feedback mike, i pushed up some updates lmk what you think!

);
// filter out existing team members from list of options unless they are the current row member
// that way the current member remains an option when editing a row
const teamMembersWithoutDuplicates = data?.moped_users.filter(
Copy link
Member

Choose a reason for hiding this comment

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

I'm not 100% sold on this variable name. Because our existing list of users already does not have duplicates in it. This is a list of team members that aren't already on the project, so its preventing duplicates.

maybe unassignedTeamMembers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cool i like that, just updated!

Copy link
Member

@chiaberry chiaberry left a comment

Choose a reason for hiding this comment

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

🚢 Good fix! and thank you for fixing that bug.
I am not sold on the variable name, but its nothing preventing this from being merged

Copy link
Collaborator

@mddilley mddilley left a comment

Choose a reason for hiding this comment

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

Works just as expected, and a bug squashed in the process! 🙏 🚢 🚀

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.

Update team table so that duplicate team members cannot be added
3 participants