Compare commits

..

1 Commits

Author SHA1 Message Date
Thomas Klaehn
7d7ca2b48f bicycle-statistics: add accumulated distances view 2019-06-16 20:49:12 +02:00
2 changed files with 7 additions and 5 deletions

View File

@ -13,8 +13,8 @@ LOG_FORMAT = "%(asctime)s %(levelname)s %(message)s"
UPDATE_INTERVAL = 60
# logging.basicConfig(format=LOG_FORMAT, level=log_level, filename=LOG_FILE)
logging.basicConfig(format=LOG_FORMAT, level=log_level)
logging.basicConfig(format=LOG_FORMAT, level=log_level, filename=LOG_FILE)
# logging.basicConfig(format=LOG_FORMAT, level=log_level)
log = logging.getLogger('bicycle-statistics')
def parse_args():

View File

@ -107,8 +107,10 @@ class Gpx2Html(object):
self.logger.info("Begin update of png's/html...")
distances = list()
avg_speeds = list()
distances_dict = dict()
for year in self.tracks.years():
distances.append(self.tracks.distances(year))
distances_dict[year] = self.tracks.distances(year)
avg_speeds.append(self.tracks.avg_speeds(year))
self.logger.info("{}: {}".format(year, self.tracks.distances))
@ -121,7 +123,6 @@ class Gpx2Html(object):
os.path.join(self.outfolder, 'avg_spd.png'))
# Accumulated distance:
distances_dict = self.tracks.__distance
accumulated_distances = dict()
for year in distances_dict.keys():
accumulated_distance = list()
@ -137,8 +138,9 @@ class Gpx2Html(object):
current_year_distance.append(accumulated_distances[current_year][i])
accumulated_distances[current_year] = current_year_distance
plot_line_chart(accumulated_distances, MONTH_LABELS, "accumulated distance", 'Month', 'km', 'acc_dist.png')
plot_line_chart(accumulated_distances, MONTH_LABELS,
"accumulated distance", 'Month', 'km',
os.path.join(self.outfolder, 'acc_dist.png'))
end_date = datetime.datetime.today()
start_date = end_date - datetime.timedelta(days=14)