aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fietsboek/models/journey.py10
-rw-r--r--fietsboek/templates/journey_details.jinja216
-rw-r--r--fietsboek/views/journey.py2
3 files changed, 26 insertions, 2 deletions
diff --git a/fietsboek/models/journey.py b/fietsboek/models/journey.py
index 512146f..d90db55 100644
--- a/fietsboek/models/journey.py
+++ b/fietsboek/models/journey.py
@@ -1,4 +1,4 @@
-import datetime
+import dataclasses
import io
import logging
import enum
@@ -149,7 +149,13 @@ class Journey(Base):
def path(self) -> geo.Path:
"""Returns the concatenated path of all contained tracks."""
- points = [point for track in self.tracks for point in track.path().points]
+ offset = 0.0
+ points = []
+ for track in self.tracks:
+ for point in track.path().points:
+ new_point = dataclasses.replace(point, time_offset=point.time_offset + offset)
+ points.append(new_point)
+ offset += point.time_offset
return geo.Path(points)
def gpx_xml(self) -> bytes:
diff --git a/fietsboek/templates/journey_details.jinja2 b/fietsboek/templates/journey_details.jinja2
index bc8137e..01d94c1 100644
--- a/fietsboek/templates/journey_details.jinja2
+++ b/fietsboek/templates/journey_details.jinja2
@@ -77,6 +77,22 @@
<th scope="row">{{ _("page.details.downhill") }}</th>
<td id="detailsDownhill">{{ movement_data.downhill | round(2) | format_decimal }} m</td>
</tr>
+ <tr>
+ <th scope="row">{{ _("page.details.moving_time") }}</th>
+ <td id="detailsDownhill">{{ timedelta(seconds=movement_data.moving_duration) }}</td>
+ </tr>
+ <tr>
+ <th scope="row">{{ _("page.details.stopped_time") }}</th>
+ <td id="detailsDownhill">{{ timedelta(seconds=movement_data.stopped_duration) }}</td>
+ </tr>
+ <tr>
+ <th scope="row">{{ _("page.details.max_speed") }}</th>
+ <td id="detailsDownhill">{{ mps_to_kph(movement_data.maximum_speed) | round(2) | format_decimal }} km/h</td>
+ </tr>
+ <tr>
+ <th scope="row">{{ _("page.details.avg_speed") }}</th>
+ <td id="detailsDownhill">{{ mps_to_kph(movement_data.average_speed) | round(2) | format_decimal }} km/h</td>
+ </tr>
</tbody>
</table>
diff --git a/fietsboek/views/journey.py b/fietsboek/views/journey.py
index 2b14c22..28df29e 100644
--- a/fietsboek/views/journey.py
+++ b/fietsboek/views/journey.py
@@ -1,5 +1,6 @@
import io
import logging
+from datetime import timedelta
from pyramid.httpexceptions import HTTPBadRequest, HTTPFound
from pyramid.request import Request
from pyramid.response import Response
@@ -42,6 +43,7 @@ def journey_details(request: Request):
"movement_data": movement_data,
"mps_to_kph": util.mps_to_kph,
"md_to_html": util.safe_markdown,
+ "timedelta": timedelta,
"show_edit_link": show_edit_link,
}