harvest-dev team mailing list archive
-
harvest-dev team
-
Mailing list archive
-
Message #00501
Re: Ignoring opportunities by last_updated field?
On Tue, 7 Dec 2010 15:22:49 -0800, Dylan McCall <dylanmccall@xxxxxxxxx> wrote:
> 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])
IIRC it came about because having the update script delete everything
and then recreate most of them was slow.
I see no problem with either changing back to the delete and re-create
method used before, or to move the last_updated check to the update
script, whichever you prefer.
Thanks,
James
References