Absolute value

merge-requests/30/head
Bob Mottram 2022-08-22 22:02:28 +01:00
parent 2a4a34b604
commit 0468731397
1 changed files with 4 additions and 4 deletions

View File

@ -531,8 +531,8 @@ def _hashtag_map_kml_within_hours(base_dir: str, tag_name: str,
"""Returns kml for a hashtag containing maps for the last number of hours """Returns kml for a hashtag containing maps for the last number of hours
""" """
secs_since_epoch = \ secs_since_epoch = \
(datetime.datetime.utcnow() - int((datetime.datetime.utcnow() -
datetime.datetime(1970, 1, 1)).total_seconds() datetime.datetime(1970, 1, 1)).total_seconds())
end_hours_since_epoch = int(secs_since_epoch / (60 * 60)) end_hours_since_epoch = int(secs_since_epoch / (60 * 60))
start_hours_since_epoch = end_hours_since_epoch - hours start_hours_since_epoch = end_hours_since_epoch - hours
kml_str = \ kml_str = \
@ -578,7 +578,7 @@ def kml_from_tagmaps_path(base_dir: str, path: str) -> str:
'/tagmaps/' + tag_name + '-' + period_str2.replace(' ', '_') '/tagmaps/' + tag_name + '-' + period_str2.replace(' ', '_')
if path == endpoint_str: if path == endpoint_str:
return _hashtag_map_kml_within_hours(base_dir, tag_name, return _hashtag_map_kml_within_hours(base_dir, tag_name,
hours) abs(hours))
return None return None
@ -596,7 +596,7 @@ def html_hashtag_maps(base_dir: str, tag_name: str,
kml_str = None kml_str = None
for period_str, hours in time_period.items(): for period_str, hours in time_period.items():
new_kml_str = \ new_kml_str = \
_hashtag_map_kml_within_hours(base_dir, tag_name, hours) _hashtag_map_kml_within_hours(base_dir, tag_name, abs(hours))
if not new_kml_str: if not new_kml_str:
continue continue
if new_kml_str == kml_str: if new_kml_str == kml_str: