From 008972046322c8e7edb755d87fd8077ae0caa919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?GOLDERWEB=20=E2=80=93=20Jonathan=20Golder?= Date: Thu, 8 Oct 2015 16:27:08 +0200 Subject: [PATCH] Replace template param Wochentag with Korrektur Use it for all dates not just for entrys containing Weeknumbers to make possible to correct dates for comparability --- charts.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/charts.py b/charts.py index 6236611..fdd13d8 100644 --- a/charts.py +++ b/charts.py @@ -242,21 +242,19 @@ entry %s' country.get( "Liste Revision" ).value = str( list_page.latest_revision_id ) + # If param Korrektur is present extract the value + if( country.has( "Korrektur" ) and + str( country.get( "Korrektur" ).value ).isnumeric() ): + days = int( str( country.get( "Korrektur" ).value ) ) + else: + days = 0 + # For some countries we have weeknumbers instead of dates if( isinstance( data[0], str ) ): # Slice year out of link destination year = int( list_page.title()[-5:-1] ) - # Check if we have a param "Wochentag", otherwise add - if not country.has( "Wochentag" ): - country.add( "Wochentag", "" ) - - if( str( country.get( "Wochentag" ).value ).isnumeric() ): - days = int( str( country.get( "Wochentag" ).value ) ) - else: - days = 0 - # Calculate date of monday in given week and add number of # days given in Template parameter "Wochentag" with monday # as day (zero) @@ -267,7 +265,7 @@ entry %s' # Param Chartein contains a regular date else: - date = data[0] + date = data[0] + timedelta( days=days ) # Check if param "Chartein" is present if not country.has( "Chartein" ):