diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2016-10-03 07:38:17 +0200 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2016-10-03 07:38:17 +0200 |
commit | 78940cde43e66e4441d86cc20508af32e261ab89 (patch) | |
tree | 195ea9536a63f94e459a9836b91d0cf3227efdc4 | |
parent | 0b7136f645122445d92d726eaa1a94626aa46576 (diff) |
Use explicit range(start, stop, step) instead of calculations to make date calculation easier to understand.
-rw-r--r-- | scrapersources/postliste-oslo-kommune-byraadsavdelingene | 10 |
1 files 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): |