From 4665c0410757e4a82ae17bf2da240c682055877d Mon Sep 17 00:00:00 2001 From: Wander Nauta Date: Sun, 24 May 2026 23:54:36 +0200 Subject: [PATCH 1/3] add "on this day" filter for activiteiten The view now supports either filtering by a specific date (and then showing all commissions) or filtering by a commission (and then showing recent and future entries). In theory, this is intended to help with questions like https://github.com/berthubert/tkconv/issues/97, but I have not been able to confirm the motions being referred to there. --- partials/activiteiten.html | 45 ++++++++++++++++++++++++++++++++------ tkserv.cc | 18 ++++++++++++--- 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/partials/activiteiten.html b/partials/activiteiten.html index 683b53d..fdc08d7 100644 --- a/partials/activiteiten.html +++ b/partials/activiteiten.html @@ -1,15 +1,45 @@ {% extends "base.html" %} {% block main %} -

Recente en toekomstige activiteiten - {%if meta.commissie != "" %} - van de {{ meta.commissienaam }} - {%endif%} +

+ {% if meta.datum != "" %} + Alle activiteiten op {{ meta.datum }} + {% else %} + Recente en toekomstige activiteiten + {% if meta.commissie != "" %} + van de {{ default(meta.commissienaam, "commissie") }} + {% endif %} + {% endif %}

-

- Activiteiten vanaf vier dagen geleden. Of spring ⏩ naar vandaag. -

+
+ {% if meta.datum == "" %} {%if meta.commissie != "" %} Alles {%else%} @@ -21,6 +51,7 @@

Recente en toekomstige activiteiten {{ d.afko }} {% if d.afko != meta.commissie %}{%else%}{%endif%} {% endfor %} +{% endif %}

diff --git a/tkserv.cc b/tkserv.cc index 7385247..ed2815b 100644 --- a/tkserv.cc +++ b/tkserv.cc @@ -1569,12 +1569,22 @@ int main(int argc, char** argv) }); sws.d_svr.Get("/activiteiten.html", [&tp](const httplib::Request &req, httplib::Response &res) { - // from 4 days ago into the future - string dlim = getDateDBFormat(time(0)-4*86400); + string earliest, latest; + string dlim = req.get_param_value("datum"); + + if (dlim.empty()) { + // from 4 days ago into the future + earliest = getDateDBFormat(time(0)-4*86400); + latest = getDateDBFormat(time(0)+20*365*86400); + } else { + // only one day. don't offer wider ranges for now + earliest = getDateDBFormat(getDateTimestamp(dlim)); + latest = getDateDBFormat(getDateTimestamp(dlim)); + } string today = getTodayDBFormat(); - auto acts = packResultsJson(tp.getLease()->queryT("select Activiteit.datum datum, activiteit.bijgewerkt bijgewerkt, activiteit.nummer nummer, naam, noot, onderwerp, besloten, voortouwAfkorting, voortouwNaam from Activiteit left join Reservering on reservering.activiteitId=activiteit.id left join Zaal on zaal.id=reservering.zaalId where datum > ? order by datum asc", {dlim})); + auto acts = packResultsJson(tp.getLease()->queryT("select Activiteit.datum datum, activiteit.bijgewerkt bijgewerkt, activiteit.nummer nummer, naam, noot, onderwerp, besloten, voortouwAfkorting, voortouwNaam from Activiteit left join Reservering on reservering.activiteitId=activiteit.id left join Zaal on zaal.id=reservering.zaalId where Activiteit.datum between date(?) and date(?, '+1 day') order by datum asc", {earliest, latest})); bool noMarkerYet = true; struct Commie @@ -1611,6 +1621,8 @@ int main(int argc, char** argv) nlohmann::json data = nlohmann::json::object(); data["data"] = acts; data["meta"]["commissie"] = commissie; + data["meta"]["datum"] = dlim.empty() ? "" : earliest; + data["meta"]["vandaag"] = today; data["meta"]["commies"] = nlohmann::json::array(); for(const auto& c : commies) { nlohmann::json commie = nlohmann::json::object(); From d8fc70163c324ea01b61a218b1ff737de3cbedc9 Mon Sep 17 00:00:00 2001 From: Wander Nauta Date: Mon, 25 May 2026 00:09:40 +0200 Subject: [PATCH 2/3] make automatic submission a bit less eager --- partials/activiteiten.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/partials/activiteiten.html b/partials/activiteiten.html index fdc08d7..ba12b23 100644 --- a/partials/activiteiten.html +++ b/partials/activiteiten.html @@ -28,7 +28,7 @@

{% else %}
  • - +
  • From 5a3cb38e80336775bd947366aaa2028866504590 Mon Sep 17 00:00:00 2001 From: Wander Nauta Date: Mon, 25 May 2026 00:19:17 +0200 Subject: [PATCH 3/3] flip elements around, remove javascript tricks --- partials/activiteiten.html | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/partials/activiteiten.html b/partials/activiteiten.html index ba12b23..beb9f8d 100644 --- a/partials/activiteiten.html +++ b/partials/activiteiten.html @@ -23,18 +23,16 @@