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
This commit is contained in:
18
charts.py
18
charts.py
@@ -242,21 +242,19 @@ entry %s'
|
|||||||
country.get( "Liste Revision" ).value = str(
|
country.get( "Liste Revision" ).value = str(
|
||||||
list_page.latest_revision_id )
|
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
|
# For some countries we have weeknumbers instead of dates
|
||||||
if( isinstance( data[0], str ) ):
|
if( isinstance( data[0], str ) ):
|
||||||
|
|
||||||
# Slice year out of link destination
|
# Slice year out of link destination
|
||||||
year = int( list_page.title()[-5:-1] )
|
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
|
# Calculate date of monday in given week and add number of
|
||||||
# days given in Template parameter "Wochentag" with monday
|
# days given in Template parameter "Wochentag" with monday
|
||||||
# as day (zero)
|
# as day (zero)
|
||||||
@@ -267,7 +265,7 @@ entry %s'
|
|||||||
|
|
||||||
# Param Chartein contains a regular date
|
# Param Chartein contains a regular date
|
||||||
else:
|
else:
|
||||||
date = data[0]
|
date = data[0] + timedelta( days=days )
|
||||||
|
|
||||||
# Check if param "Chartein" is present
|
# Check if param "Chartein" is present
|
||||||
if not country.has( "Chartein" ):
|
if not country.has( "Chartein" ):
|
||||||
|
|||||||
Reference in New Issue
Block a user