Skip to content

Instantly share code, notes, and snippets.

@hdngr
Created January 1, 2025 16:25
Show Gist options
  • Save hdngr/286d1d5c560473a2eabd6566dd41b4c0 to your computer and use it in GitHub Desktop.
Save hdngr/286d1d5c560473a2eabd6566dd41b4c0 to your computer and use it in GitHub Desktop.
// Property stores a relationship to another model/table called Occupancy
// Occupancy is a set of projections for each month. Occupancy projections when relevant data is updated... Leases, property leasable sqft,
// etc.
// The core challenge trying to solve for is that filtering and sorting based on occupancy introduces complexities and will likely be hard to maintain.
// The two courses of action are:
// 1) deal with complexity of managing relationship to do advanced sorting on property based on "current month" occupancy
// 2) create Property.occupancyThisMonth which is updated whenever occupancy is updated AND at the end of each month
Property = {
...,
occupancy: [1,2,3,4,5]
}
// January 2025
Occupancy1 = {
...
month: "2025-01-31T23:59:59.999Z", // Date very last milisecond of the month for the end of the reporting period
occupancy: 0.87
}
// February 2025
Occupancy1 = {
...
month: "2025-02-28T23:59:59.999Z", // Date very last milisecond of the month for the end of the reporting period
occupancy: 0.89
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment