diff options
| author | Christoph Coijanovic <hi@coijanovic.com> | 2026-09-03 14:02:28 +0200 |
|---|---|---|
| committer | Christoph Coijanovic <hi@coijanovic.com> | 2026-09-03 14:02:28 +0200 |
| commit | 1755771ece5ab9bc095578fb4ad54be9e86feb70 (patch) | |
| tree | e29dbf5abd1ced39557a446a1b63e7effa506c31 | |
| parent | 4a10aa6d661ed1fe06623bb3ae7a0b52b2a81997 (diff) | |
| download | fietsboek-1755771ece5ab9bc095578fb4ad54be9e86feb70.tar.gz fietsboek-1755771ece5ab9bc095578fb4ad54be9e86feb70.tar.bz2 fietsboek-1755771ece5ab9bc095578fb4ad54be9e86feb70.zip | |
added minimum and maximum uphill filters to browse view
| -rw-r--r-- | fietsboek/locale/de/LC_MESSAGES/messages.mo | bin | 20748 -> 20960 bytes | |||
| -rw-r--r-- | fietsboek/locale/de/LC_MESSAGES/messages.po | 12 | ||||
| -rw-r--r-- | fietsboek/locale/en/LC_MESSAGES/messages.mo | bin | 19545 -> 19742 bytes | |||
| -rw-r--r-- | fietsboek/locale/en/LC_MESSAGES/messages.po | 12 | ||||
| -rw-r--r-- | fietsboek/templates/browse.jinja2 | 20 | ||||
| -rw-r--r-- | fietsboek/views/browse.py | 28 |
6 files changed, 72 insertions, 0 deletions
diff --git a/fietsboek/locale/de/LC_MESSAGES/messages.mo b/fietsboek/locale/de/LC_MESSAGES/messages.mo Binary files differindex 71b7ce8..ec717d2 100644 --- a/fietsboek/locale/de/LC_MESSAGES/messages.mo +++ b/fietsboek/locale/de/LC_MESSAGES/messages.mo diff --git a/fietsboek/locale/de/LC_MESSAGES/messages.po b/fietsboek/locale/de/LC_MESSAGES/messages.po index 14f3e63..3d6c4aa 100644 --- a/fietsboek/locale/de/LC_MESSAGES/messages.po +++ b/fietsboek/locale/de/LC_MESSAGES/messages.po @@ -269,6 +269,18 @@ msgstr "Längenbeschränkungen" msgid "page.browse.filter.length_maximum" msgstr "Maximale Länge" +#: fietsboek/templates/browse.jinja2:34 +msgid "page.browse.filter.uphill_minimum" +msgstr "Minimaler Bergauf" + +#: fietsboek/templates/browse.jinja2:40 +msgid "page.browse.filter.uphill_boundaries" +msgstr "Bergaufbeschränkungen" + +#: fietsboek/templates/browse.jinja2:46 +msgid "page.browse.filter.uphill_maximum" +msgstr "Maximaler Bergauf" + #: fietsboek/templates/browse.jinja2:59 msgid "page.browse.filter.date_boundaries" msgstr "Datumsgrenzen" diff --git a/fietsboek/locale/en/LC_MESSAGES/messages.mo b/fietsboek/locale/en/LC_MESSAGES/messages.mo Binary files differindex 364b305..95464f3 100644 --- a/fietsboek/locale/en/LC_MESSAGES/messages.mo +++ b/fietsboek/locale/en/LC_MESSAGES/messages.mo diff --git a/fietsboek/locale/en/LC_MESSAGES/messages.po b/fietsboek/locale/en/LC_MESSAGES/messages.po index 311f1aa..b94eb76 100644 --- a/fietsboek/locale/en/LC_MESSAGES/messages.po +++ b/fietsboek/locale/en/LC_MESSAGES/messages.po @@ -269,6 +269,18 @@ msgstr "Length limits" msgid "page.browse.filter.length_maximum" msgstr "Maximum length" +#: fietsboek/templates/browse.jinja2:34 +msgid "page.browse.filter.uphill_minimum" +msgstr "Minimum uphill" + +#: fietsboek/templates/browse.jinja2:40 +msgid "page.browse.filter.uphill_boundaries" +msgstr "Uphill limits" + +#: fietsboek/templates/browse.jinja2:46 +msgid "page.browse.filter.uphill_maximum" +msgstr "Maximum uphill" + #: fietsboek/templates/browse.jinja2:59 msgid "page.browse.filter.date_boundaries" msgstr "Date limits" diff --git a/fietsboek/templates/browse.jinja2 b/fietsboek/templates/browse.jinja2 index f1420b8..b4a99b2 100644 --- a/fietsboek/templates/browse.jinja2 +++ b/fietsboek/templates/browse.jinja2 @@ -51,6 +51,26 @@ <div class="col-md-4"> <div class="input-group"> <button type="button" class="btn btn-outline-secondary button-clear-input"><i class="bi bi-eraser-fill"></i></button> + <input name="min-uphill" type="number" class="form-control ui-element" placeholder="{{ _("page.browse.filter.uphill_minimum") }}" value="{{ request.params.get('min-uphill', '') }}"> + <span class="input-group-text ui-element">m</span> + </div> + </div> + + <div class="col-md-4 fs-5 d-flex align-items-center justify-content-center ui-element"> + {{ _("page.browse.filter.uphill_boundaries") }} + </div> + + <div class="col-md-4"> + <div class="input-group"> + <button type="button" class="btn btn-outline-secondary button-clear-input"><i class="bi bi-eraser-fill"></i></button> + <input name="max-uphill" type="number" class="form-control ui-element" placeholder="{{ _("page.browse.filter.uphill_maximum") }}" value="{{ request.params.get('max-uphill', '') }}"> + <span class="input-group-text ui-element">m</span> + </div> + </div> + + <div class="col-md-4"> + <div class="input-group"> + <button type="button" class="btn btn-outline-secondary button-clear-input"><i class="bi bi-eraser-fill"></i></button> <input name="min-date" type="date" class="form-control ui-element" value="{{ request.params.get('min-date', '') }}"> </div> </div> diff --git a/fietsboek/views/browse.py b/fietsboek/views/browse.py index d823f69..44aba38 100644 --- a/fietsboek/views/browse.py +++ b/fietsboek/views/browse.py @@ -342,6 +342,34 @@ class FilterCollection(Filter): ) ) + if request.params.get("min-uphill"): + min_uphill = _get_int(request, "min-uphill") + filters.append( + LambdaFilter( + lambda query, track: query.where( + or_( + models.TrackCache.uphill >= min_uphill, + models.TrackCache.uphill == None, # noqa: E711 + ) + ), + lambda track: track.uphill >= min_uphill, + ) + ) + + if request.params.get("max-uphill"): + max_uphill = _get_int(request, "max-uphill") + filters.append( + LambdaFilter( + lambda query, track: query.where( + or_( + models.TrackCache.uphill <= max_uphill, + models.TrackCache.uphill == None, # noqa: E711 + ) + ), + lambda track: track.uphill <= max_uphill, + ) + ) + if request.params.get("min-date"): min_date = _get_date(request, "min-date") min_date = datetime.datetime.combine(min_date, datetime.time.min) |
