-
Notifications
You must be signed in to change notification settings - Fork 85
Add joined_as_teenager to User
#12607
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
base: main
Are you sure you want to change the base?
Conversation
|
making birthday encrypted strikes again smh |
Co-authored-by: Gary Tou <gary@garytou.com>
|
Once the other PR merges, there will be a conflict here. Fix that and then this will be good to merge! |
|
We'll need to backfill |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is structured different than the UpdateTeenagerColumnJob but I think it should still work.
| include HasTasks | ||
|
|
||
| before_update { self.teenager = teenager? } | ||
| before_update { self.joined_as_teenager = joined_as_teenager? } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| before_update { self.joined_as_teenager = joined_as_teenager? } | |
| before_update(if: :will_save_change_to_birthday?) { self.joined_as_teenager = joined_as_teenager? } |
Double check my code, but this may be what you want.
| def joined_as_teenager? | ||
| age_on(created_at)&.<=(18) | ||
| end | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will end up clashing with the joined_as_teenager? defined by Rails pulling from the database. Should we call this something else so that we pull from the DB when possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gary and I discussed this and I think we're going to loop back to fix this as it also affects teenager?
This allows us to get a more accurate count on referrals