← Back to team overview

harvest-dev team mailing list archive

Ignoring opportunities by last_updated field?

 

Hello!

With bug #685984 [1], I generalised the stuff for getting a list of
valid opportunities in harvest.views. (Unfortunately, that heap of
code remains terribly ugly. Another day…).
In the process, I was reminded of an odd bit.

Right now, getting valid opportunities looks like this:
filter(valid=True, opportunitylist__active=True,
last_updated=F('opportunitylist__last_updated'))

For the unaware, Django's F object lets us compare a field in an
object to another of its fields, instead of just a constant.

If I understand correctly, last_updated is only ever set by Harvest's
update script. So, it feels wrong to repeatedly check something that
is only changed with the occasional cron job. Can we have that script
invalidate opportunities when they aren't updated? Then harvest.views
only needs to care about valid and opportunitylist__active.
(Also, I have a bug report and a branch for tidying the admin page,
including it impossible to change last_updated, at bug #659380 [2])

It isn't a big deal; my very unscientific performance testing says it
doesn't make a big difference there. But it does get rid of some
complexity :)

[1] https://bugs.edge.launchpad.net/harvest/+bug/685984
[2] https://bugs.edge.launchpad.net/harvest/+bug/659380


Dylan



Follow ups