From 78940cde43e66e4441d86cc20508af32e261ab89 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Mon, 3 Oct 2016 07:38:17 +0200 Subject: Use explicit range(start, stop, step) instead of calculations to make date calculation easier to understand. --- scrapersources/postliste-oslo-kommune-byraadsavdelingene | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scrapersources/postliste-oslo-kommune-byraadsavdelingene b/scrapersources/postliste-oslo-kommune-byraadsavdelingene index b54d182..0fa0c57 100644 --- a/scrapersources/postliste-oslo-kommune-byraadsavdelingene +++ b/scrapersources/postliste-oslo-kommune-byraadsavdelingene @@ -171,8 +171,9 @@ skiplimit = 10 totalcount = 0 # Look forward one week to at least get past the weekends, rescan the -# last day in case new records showed up in the mean time. -for n in xrange(skiplimit+1): +# last day in case new records showed up in the mean time. Next, scan +# backwards, one day before the oldest entry in the database. +for n in range(0, skiplimit, 1): day = newest + aday * n # print day totalcount = totalcount + fetch_day(parser, day) @@ -180,9 +181,8 @@ for n in xrange(skiplimit+1): print "Running short on CPU time, exiting" sys.exit(0) -# Scan backwards, one day before the oldest entry in the database -for n in xrange(skiplimit): - day = oldest - aday * (n+1) +for n in range(-1, -skiplimit, -1): + day = oldest + aday * n # print day totalcount = totalcount + fetch_day(parser, day) if cpu_spent() > (cpu_available() - 3): -- cgit v1.2.3