-
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: unit tables multiple rows for same rent type, sorting issues #1306
fix: unit tables multiple rows for same rent type, sorting issues #1306
Conversation
✔️ Deploy Preview for clever-edison-cd22c1 ready! 🔨 Explore the source changes: 70685bc 🔍 Inspect the deploy log: https://app.netlify.com/sites/clever-edison-cd22c1/deploys/60bfd4491e41330008b156a2 😎 Browse the preview: https://deploy-preview-1306--clever-edison-cd22c1.netlify.app |
ae1d6d7
to
591461a
Compare
c8632fc
to
350b524
Compare
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 saw one typo. Otherwise, changes make sense. I'm wondering if we can further break this file out into more discrete functions/constants? LOC is creeping ever higher…
{ | ||
min: parseFloat(summary.minIncomeRange?.min), | ||
max: parseFloat(summary.minIncomeRange?.max), | ||
const getCurrenyString = (initialValue: string) => { |
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.
⬆️ typo
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.
fixed, thanks!
Curious what you would suggest breaking out? (Also does LOC stand for lines of code?) |
Yeah, Lines of Code. So basically anything that isn't directly performing the data transformations specific to unit sumamries/hmi/etc. I would recommend breaking out (and this isn't anything specific to your work, looks like the file's been touched by a bunch of people and there might be some stuff lurking underneath I originally worked on). Suggestions:
|
That all makes a ton of sense! Thank you for taking a look and giving me context :) |
Sure, np :) |
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.
Hey @emilyjablonski , this looks good. I generally agree with @jaredcwhite 's comments, though I'm not sure how much of it we want to do here. For UnitTypeSort for example, I created a separate issue to convert unitType to an enum and have UnitTypeSort be replaced with that.
I have a question on the summaries sort too.
return summary | ||
} | ||
|
||
type UnitMap = { | ||
[key: string]: Unit[] | ||
} | ||
|
||
const UnitTypeSort = ["studio", "oneBdrm", "twoBdrm", "threeBdrm"] |
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 should probably be moved to an enum that unitType
also uses on the unit entity. I don't think we need to do this right now with this task though, so I created this issue #1335
return summaries.filter((item) => Object.keys(item).length > 0) | ||
return summaries.sort((a, b) => { | ||
return ( | ||
UnitTypeSort.indexOf(a.unitType[0]) - UnitTypeSort.indexOf(b.unitType[0]) || |
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.
Isn't the value of unitType a string here, like "threeBdrm"? If that's the case, then a.unitType[0] would be "t" in this example.
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.
It's the index of the string in the array, so the value is a number - double checking this now to see if I goofed!
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.
Should be all set now 👍 I think the reason this typo didn't create any visible issues is because the income is also tied pretty deeply to unit size, and we don't have any units right now where unit would be a tie breaker for income
e5ef479
to
2793aa8
Compare
2793aa8
to
70685bc
Compare
Pull Request Template
Issue
Addresses HBA#247 #1297
Description
This PR tackles two issues. The first is that when I made the change to show multiple rows for different rent types (% income vs static number), it also ended up showing multiple rows for the same type if the values were different. For example, Coliseum appeared as below with the bug. There should be two rows for 2 BR, not three. The different static rent numbers should appear as a range.
With this fix, it now appears as below.
The second issue this solves is unit summaries coming through unsorted (see the linked issues).
I also just tried my best to clean up the fxns, they were confusing.
Type of change
How Can This Be Tested/Reviewed?
Import a listing with rent ranges, like Coliseum. Check out the unit summaries table, the occupancy ranges, and the floor ranges.
Checklist: