You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Atul Varma edited this page Mar 11, 2019
·
12 revisions
This page contains some code snippets that might be useful for one-off use. Since they're not part of the primary codebase, of course, they may not work anymore. Please feel free to delete or update them if that's the case.
Caching derived data for onboarding
#401 contained a snippet we can run when we add a new derived data field for onboarding:
Listing users who reported as NYCHA but don't live in NYCHA housing
SELECTonb.user_idFROM onboarding_onboardinginfo as onb
WHEREonb.lease_type='NYCHA'ANDonb.pad_bbl<>''ANDonb.pad_bbl NOT IN (
SELECT pad_bbl from nycha_nychaproperty
)
Listing users who have logged in since sending their letter of complaint
SELECTu.username, u.last_login, lr.created_atFROM users_justfixuser AS u, loc_letterrequest AS lr
WHEREu.id=lr.user_idANDu.last_login>lr.created_at;