
Ask HN: Design patterns for granting access to data scoped to blocks of time? - dchuk
I&#x27;m struggling to come up with the right query terms for Google on this one.<p>Here&#x27;s the basic business problem I&#x27;m trying to solve:<p>Let&#x27;s say I have a car rental company. I rent cars one week at a time. I have reports for things like mileage over time periods for my renters to use.<p>Here&#x27;s a scenario:<p>Customer 1 rents Car 1 for 1 week, drives 100 miles. Customer 2 then rents Car 1 for 1 week, drives 200 miles. Customer 1 rents Car 1 again for a week, and another 100 miles.<p>In my mileage report, I want to give Customer 1 access to the mileage accrued in by Car 1, but only for the blocks of time that they were the renters of the Car (so week 1 and week 3). Likewise, Customer 2 should only be able to access their block of time of rental (week 3).<p>Setting the UX concerns aside of chunks of missing data in a report, are there any established patterns out there for this type of query situation?
======
tlack
Maybe I am under-thinking it, but why not just gray out and obscure those
regions of the graph (or whatever) with a label "Different Driver"?

------
hluska
I'm pretty sure that I don't understand this, but can't you represent that
problem with this sql?

SELECT mileage FROM table WHERE customer_id = 1;

Am I on the right track?

