Skip to content

Commit

Permalink
Show event counts
Browse files Browse the repository at this point in the history
  • Loading branch information
flopp committed Nov 23, 2024
1 parent 707b51b commit c72a483
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
all:
@echo "make upload -> build and upload to freiburg.run"
@echo "make sync -> build and upload to freiburg.runt"
@echo "make run-script -> sync & run remote script"


.bin/generate-linux: main.go internal/utils/*.go go.mod
mkdir -p .bin
Expand All @@ -10,11 +12,6 @@ build:
rm -rf .out
go run main.go -config config.json -out .out -hashfile .hashes -addedfile .added

.phony: upload
upload: build
scp -r .out/* .out/.htaccess echeclus.uberspace.de:/var/www/virtual/floppnet/freiburg.run/
scp -r .out/* .out/.htaccess echeclus.uberspace.de:/var/www/virtual/floppnet/fraig.de/

.phony: upload-test
upload-test: build
scp -r .out/* .out/.htaccess echeclus.uberspace.de:/var/www/virtual/floppnet/fraig.de/
Expand Down
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,16 @@ func (d TemplateData) YearTitle() string {
return d.Title
}

func (d TemplateData) CountEvents() int {
count := 0
for _, event := range d.Events {
if !event.IsSeparator() {
count += 1
}
}
return count
}

type EventTemplateData struct {
Event *Event
Title string
Expand Down
2 changes: 1 addition & 1 deletion templates/events.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h1 class="title" itemprop="name">{{.Title}}</h1>

<div class="notification is-link is-light">
Liste von <b>aktuellen und zukünftigen</b> Laufveranstaltungen, Wettkämpfen, Volksläufen im Raum Freiburg (~50km Umkreis), sortiert nach Datum.
Liste von {{.CountEvents}} <b>aktuellen und zukünftigen</b> Laufveranstaltungen, Wettkämpfen, Volksläufen im Raum Freiburg (~50km Umkreis), sortiert nach Datum.
<br />
Ist ein Eintrag fehlerhaft oder fehlt eine Veranstaltung? - bitte <a href="/info.html#kontakt">melden</a>.
<br />
Expand Down

0 comments on commit c72a483

Please sign in to comment.