aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fietsboek/templates/profile.jinja24
-rw-r--r--fietsboek/views/profile.py3
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,
}