maposmatic-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Maposmatic-dev] [PATCH maposmatic] Add a rendered maps feed


From: Maxime Petazzoni
Subject: Re: [Maposmatic-dev] [PATCH maposmatic] Add a rendered maps feed
Date: Wed, 10 Feb 2010 12:34:46 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

* Maxime Petazzoni <address@hidden> [2010-02-10 10:12:41]:

> That's a good point. But we need a combination of the two: all
> renderings from the past 24 hours, but /at least/ ten of them, when
> possible, otherwise we could end up with an empty feed (not likely, but
> we never know).

Does that look good?

    def items(self):
        """Returns the successfull rendering jobs from the last 24 hours, or
        more to get at least 10 items in the feed, when possible."""


        job_list = (models.MapRenderingJob.objects
                    .filter(status=2)
                    .filter(resultmsg='ok')
                    .order_by('-endofrendering_time'))

        one_day_before = datetime.datetime.now() - datetime.timedelta(1)
        if job_list.filter(endofrendering_time__gte=one_day_before).count() < 
10:
            job_list = job_list[:10]

        return job_list


If yes, I have the updated commit ready for merge+push.

Thanks,
- Maxime
-- 
Maxime Petazzoni <http://www.bulix.org>
 ``One by one, the penguins took away my sanity.''
Linux kernel and software developer at MontaVista Software

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]