casa
casa copied to clipboard
Add a unique constraint for volunteer, langauge pairs in the join table
Description Add a unique constraint for languages a volunteer can have
Screenshots of current behavior, if any
As seen on the edit profile page for a volunteer
Login Emails:
- [email protected] view site as a volunteer
- [email protected] view site as a supervisor
- [email protected] view site as an admin
password for all users: 12345678
Questions? Join Slack!
We highly recommend that you join us in slack https://rubyforgood.herokuapp.com/ #casa channel to ask questions quickly and hear about office hours (currently Tuesday 6-8pm Pacific), stakeholder news, and upcoming new issues.
Hello! Can I work on this one?
I sent you an invite for write permissions so you can claim your own issues
Thanks for the invite! I'll gladly continue contributing to CASA!
That was the wrong screenshot. I updated it
Hey! I have some questions about how you would prefer I implement this issue.
The way it is implemented currently, we have multiple entries in the Language table with the same name, each belonging to different single users. This makes the has_and_belongs_to_many relation useless since even if a language can belong to 2 users, it isn't being used this way.
Proposed solution 1 (fewer changes in the database): Change the relation between user and language to "User has many Languages" and keep the repeated records of Language. This solution won't require any changes in the way languages are added to users right now, but will maintain unnecessary database usage
Proposed solution 2 (more database changes): Keep the has and belongs to many relation, remove repeated records, and change the way that languages are being added, from creating a new language every time to creating a new relation between User and Language.
Which implementation would you guys prefer?
Oh I think you understood the problem based on the old screenshot. It's ok I'll just change the issue to match. We do want it to be unique for each user, language pair.
I think we want a migration to remove any duplicates and then make language user combination in the languages_users
table unique
Hey, I'm not confident in my solution to this issue, worried that ill break something in the database. Is it ok if I unassign myself?
Thanks!