rubyforgood / pet-rescue

Pet Rescue is an application making it easy to link adopters/fosters with pets. We work with grassroots pet rescue organizations to understand how we can make the most impact.
MIT License
57 stars 95 forks source link

Create FormSubmission model #851

Closed kasugaijin closed 1 month ago

kasugaijin commented 1 month ago

This is a model that binds a set of submitted answers together from a form with a Person. Create the model and form_submissions table with person_id and organization_id foreign keys.

Model associations:

Please add model tests.

Gabe-Torres commented 1 month ago

I'll take this one!

kasugaijin commented 1 month ago

@Gabe-Torres all yours

Gabe-Torres commented 1 month ago

Hey @kasugaijin!

I ran into a couple of issues when creating the form_submissionmodel. I know there are some incoming big changes to the codebase, so maybe these will be resolved within the next couple of weeks.

I successfully created the form_submission model and test. In the process of updating the adopter_applications model test to account for the changes, I made an associations context block. I also had to create a quick factory so form_submission can be referenced within the test. After a couple of tweaks, the form_submission, adopter_applications, and submitted_answers model tests are all passing. However, the database will no longer seed properly. My guess is that the seeds need to be updated accordingly to account for the new changes. There are also quite a few errors after running the test suites.

I wanted to make sure I am heading in the right direction with this issue/PR.

Should I update the seeds and errors where needed? Was there no associations block within adopter_applicaitons yet for this reason? Is creating a factory for form_submission and implementing it within adopter_applications something you wanted done in this PR? Or should I just create the new form_submission model and leave the other changes for a different issue ticket?

Thank you!

kasugaijin commented 1 month ago

@Gabe-Torres i should have time to get a proper look in tomorrow! But yes it’s pretty common to need to update the seed data if an association has changed that the seeds rely upon.

Gabe-Torres commented 1 month ago

Ah okay that does make sense! Thank you. Apologies for the 20 questions too 😂