Skip to content

add age preference question to main app flow + filter bug #132

@InayaY3

Description

@InayaY3

yayy first sprint of the semt!! 🤩

This week, you’ll be altering our main application flow to include an age preference question and fixing a minor bug in our hierarchical filtering (PR from last sem, ignore testing method) to familiarize yourself with our backend!

1. Fix the bug that prevents female inmates from being returned during the matching process.

  • I suggest looking into union all statements and using them to alter our current logic that uses order by.
  • Make sure to test this extensively! The “how to review” section here might be helpful, and you should get comfortable with using test rows in our adopter_applications_dummy table.

2. Add a new question component called MainQuestionAge.tsx, which should ask the user about age preference.

  • Since we don’t have any styling for it currently, you can have a very barebones layout for the time being (i.e., the question reads “What is your preference for the age of your adoptee? Please enter a valid range.” and just a text-input for now). Feel free to copy code from existing main app questions.
  • Don’t forget to update the FormState interface in types.d.ts and other references to question data/inputs. Ensure that the new question navigation order is bio → gender → offense → age → reason → review responses.

3. Update our backend for the application to take in age preference.

  • Create a new column in adopter_applications_dummy called age_pref with the int2 array type (e.g. we would have [20, 40] to mean 20-40 years old). Make sure to regenerate the types in database.types.ts to match. If you haven’t done this before, make sure you define PROJECT_ID in your .env file, login with the Supabase CLI, then run pnpm gen-schema.
  • Ensure that upsertApplication in query.ts is now upserting information about the age preference to adopter_applications_dummy.
  • Since we’re currently using a text-input, make sure that you are parsing and storing the age preference response as an int[], even within the application state.

Side note: be careful editing things in Supabase as we don’t have version control for any of the queries. One way you can do this is by creating a duplicated find_top_k_filtered function to edit and then updating our existing one once you know it works! You’ll have to regenerate types and update query.ts to be able to test + use your function.

I know some of this may be your first interactions with our backend, so please reach out if you need help getting started or have any questions!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions