-
Notifications
You must be signed in to change notification settings - Fork 24
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
fix: improve seed data and validity #4099
Conversation
api/prisma/seed-dev.ts
Outdated
householdMember: householdMembers, | ||
multiselectQuestions, | ||
}), | ||
for (let j = 0; j <= APPLICATIONS_PER_LISTINGS - 1; j++) { |
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.
Previously, all applications had the same household size and same household members, and one more application than the actual APPLICATIONS_PER_LISTING
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.
real nit pick: could we change this to for (let j = 0; j < APPLICATIONS_PER_LISTINGS; j++) {
just a lil less code
create: addressFactory(), | ||
} | ||
: undefined, | ||
orderId: index, |
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.
Without this new index, we were previously unable to view individual household members on an application in partners
phoneNumber: undefined, | ||
emailAddress: undefined, | ||
agency: undefined, | ||
address: { create: addressFactory() }, |
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 technically inaccurate but we're sending a strange empty-but-with-id address on alternate contact through the frontend on actual application submission and that felt like a bigger problem
birthDay: randomBirthDay(), | ||
birthYear: randomBirthYear(), | ||
sameAddress: YesNoEnum.yes, | ||
relationship: relationshipKeys[randomInt(relationshipKeys.length)], |
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.
Now including relationship
@@ -6,7 +6,7 @@ export const jurisdictionFactory = ( | |||
listingApprovalPermissions?: UserRoleEnum[], | |||
): Prisma.JurisdictionsCreateInput => ({ | |||
name: jurisdictionName, | |||
notificationsSignUpUrl: null, | |||
notificationsSignUpUrl: 'https://www.exygy.com', |
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.
Allows the notifications block to show up in dev
✅ Deploy Preview for bloom-exygy-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -492,7 +492,7 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { | |||
|
|||
const householdCols = [] | |||
|
|||
for (let i = 0; i < maxHouseholdSize; i++) { | |||
for (let i = 0; i < maxHouseholdSize - 1; i++) { |
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.
Previously on the applications table in partners, we were always showing an additional set of household member columns that never had data
@@ -562,7 +562,7 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { | |||
width: 125, | |||
minWidth: 100, | |||
valueFormatter: ({ value }) => { | |||
if (!value) return "" | |||
if (value.length < householdIndex) return "" |
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.
Previously, we were showing n/a
just in these columns for otherwise empty household members
dataTestId="alternateContact" | ||
/> | ||
</Grid.Row> | ||
{application.alternateContact?.type !== AlternateContactRelationship.noContact && ( |
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.
If there is no alternate contact, don't show the address section for it
birth: t("application.household.member.dateOfBirth"), | ||
sameResidence: t("application.add.sameResidence"), | ||
workInRegion: t("application.details.workInRegion"), | ||
name: "t.name", |
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 was throwing console errors - it's a little odd but the function these are passed into just takes the string which it passes into t()
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.
Alternate contact didn't exist
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.
Just added missing data
@@ -0,0 +1,7 @@ | |||
export enum AlternateContactRelationship { |
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.
Can we check with product if we should be making this and the HouseholdMemberRelationship enums readable in the CSV export?
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.
@emilyjablonski can you also make a ticket to change the db to be enums instead of strings as well
I think that work needs to be captured separately as the roll out for it will require migrations and db work
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.
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.
And that CSV issue looks existing, but I'll look for a ticket!
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.
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.
Looks good!
some questions and nits
api/prisma/seed-dev.ts
Outdated
householdMember: householdMembers, | ||
multiselectQuestions, | ||
}), | ||
for (let j = 0; j <= APPLICATIONS_PER_LISTINGS - 1; j++) { |
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.
real nit pick: could we change this to for (let j = 0; j < APPLICATIONS_PER_LISTINGS; j++) {
just a lil less code
|
||
export const alternateContactFactory = | ||
(): Prisma.AlternateContactCreateWithoutApplicationsInput => { | ||
const relationshipKeys = Object.values(AlternateContactRelationship); |
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 paired with line 12 is so smart!
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.
I stole it from Morgan haha
@@ -0,0 +1,7 @@ | |||
export enum AlternateContactRelationship { |
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.
@emilyjablonski can you also make a ticket to change the db to be enums instead of strings as well
I think that work needs to be captured separately as the roll out for it will require migrations and db work
sites/partners/src/components/applications/ApplicationsColDefs.ts
Outdated
Show resolved
Hide resolved
@YazeedLoonat So sorry, I re-requested a review, but realized I never actually pushed the commit lol |
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.
LGTM
Pull Request Template
Description
I ran into a lot of issues testing duplicate problems locally because of some invalid and missing seed data - this PR fixes a handful of problems related to seed data and a few bugs with how that data was showing up in the applications table. I added a comment to each fix. It also types two application fields with an enum that were previously just a set of strings the frontend was sending to the backend.
How Can This Be Tested/Reviewed?
Run
yarn setup:dev
and check out the applications table on a listing to see more applications with more data and more variety.Submit an application and fill out alternate contact and household member data to ensure it comes through as expected on the partners side to ensure the new typing places nicely.
Checklist:
yarn generate:client
and/or created a migration if I made backend changes that require themReviewer Notes:
Steps to review a PR:
On Merge:
If you have one commit and message, squash. If you need each message to be applied, rebase and merge.