I am working on a reverse auction system. Listings can be set to be visible for 3,5 or 7 days and I store this data, along with the created and end epoch in the object. What I want a view to do however is only bring back listings which have not ended, if i work this date calculation out in the map then the view result becomes stale as the map does not get re run on every query, neither can it for scalability. Currently I’m returning the max period of 7 days and trimming out the lesser days that have ended in code. But this is horrible, i was wondering what you would suggest?
To mitigate the extra data i gather by always getting 7 days worth of data, even if a listing may have ended in 3 days I have implemented the following:
A cron process which grabs all ‘active’ listings using the current method but rather than excluding expired items, updates their type to a finished listing type. This means these types will not be returned for the view as the type will not match an active listing type.
I will still be selecting a little bit of extra data…so ideally id like a better solution, but if i do this every hour it will only include an extra hours worth of expired items to filter out in code rather than having a few extra days.
Any better ideas?