Compare commits

..

1 Commits

Author SHA1 Message Date
Thomas Klaehn
38a3454dbc bicycle-statistics: add accumulated distances view 2019-06-16 08:34:37 +02:00
2 changed files with 5 additions and 7 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,10 +107,8 @@ 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))
@ -123,6 +121,7 @@ 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()
@ -138,9 +137,8 @@ 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',
os.path.join(self.outfolder, 'acc_dist.png'))
plot_line_chart(accumulated_distances, MONTH_LABELS, "accumulated distance", 'Month', 'km', 'acc_dist.png')
end_date = datetime.datetime.today()
start_date = end_date - datetime.timedelta(days=14)