diff options
author | Daniel Schadt <kingdread@gmx.de> | 2023-03-25 13:46:45 +0100 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2023-03-25 13:46:45 +0100 |
commit | 6581d947c212b46d22f0fbb17afa80394faf2521 (patch) | |
tree | 83b12995abae43918a18c01f6ed8b5b34990086f | |
parent | 56a214206fb44c83a69326f6798d842eac19511b (diff) | |
download | fietsboek-6581d947c212b46d22f0fbb17afa80394faf2521.tar.gz fietsboek-6581d947c212b46d22f0fbb17afa80394faf2521.tar.bz2 fietsboek-6581d947c212b46d22f0fbb17afa80394faf2521.zip |
add number of tracks to profile
-rw-r--r-- | fietsboek/templates/profile.jinja2 | 4 | ||||
-rw-r--r-- | fietsboek/views/profile.py | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/fietsboek/templates/profile.jinja2 b/fietsboek/templates/profile.jinja2 index 34bb2de..5170109 100644 --- a/fietsboek/templates/profile.jinja2 +++ b/fietsboek/templates/profile.jinja2 @@ -36,6 +36,10 @@ <th scope="row">{{ _("page.details.avg_speed") }}</th> <td id="detailsAvgSpeed">{{ mps_to_kph(avg_speed) | round(2) | format_decimal }} km/h</td> </tr> + <tr> + <th scope="row">{{ _("page.profile.number_of_tracks") }}</th> + <td id="profileNumberOfTracks">{{ number_of_tracks }}</td> + </tr> </table> </div> {% endblock %} diff --git a/fietsboek/views/profile.py b/fietsboek/views/profile.py index 6bd566a..657f955 100644 --- a/fietsboek/views/profile.py +++ b/fietsboek/views/profile.py @@ -38,6 +38,7 @@ def profile(request: Request) -> dict: total_moving_time = datetime.timedelta(0) total_stopped_time = datetime.timedelta(0) max_speed = 0.0 + number_of_tracks = 0 track: models.Track for track in request.context.tracks: @@ -52,6 +53,7 @@ def profile(request: Request) -> dict: total_moving_time += meta.moving_time total_stopped_time += meta.stopped_time max_speed = max(max_speed, meta.max_speed) + number_of_tracks += 1 avg_speed = total_length / total_moving_time.total_seconds() total_moving_time = round_to_seconds(total_moving_time) @@ -99,6 +101,7 @@ def profile(request: Request) -> dict: "max_speed": max_speed, "avg_speed": avg_speed, "mps_to_kph": util.mps_to_kph, + "number_of_tracks": number_of_tracks, "heatmap_url": heatmap_url, "tilehunt_url": tilehunt_url, } |