diff --git a/.githooks/commit-msg b/.githooks/commit-msg new file mode 100755 index 0000000..ba6f5d9 --- /dev/null +++ b/.githooks/commit-msg @@ -0,0 +1,19 @@ +#!/bin/sh + +commit_message=$(<"$1") + +if ! [[ $commit_message =~ ^(vingo:|vinscant:|vinvoor:|zess:) ]]; then + echo "Error: commit message should start with vingo:|vinscant:|vinvoor:|zess: depending on which subproject you are working on." + exit 1 +fi + +if ! [[ $commit_message =~ ^.*:\ [a-z].* ]]; then + echo "Error: first letter after project specifier should be lower case +Example: + vingo: add cheese + ^ + | this one" + exit 1 +fi + +exit 0 \ No newline at end of file diff --git a/.github/workflows/commit_message_check.yml b/.github/workflows/commit_message_check.yml new file mode 100644 index 0000000..04bcbce --- /dev/null +++ b/.github/workflows/commit_message_check.yml @@ -0,0 +1,33 @@ +name: commit message check +run-name: commit message check +on: + push: + branches: + - main + pull-request: + +jobs: + check_commit_messages: + runs-on: ubuntu-latest + + steps: + - name: checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: check commit messages + run: | + git log --format="%s" origin/main..HEAD | while IFS= read -r message; do + if ! [[ $message =~ ^(vingo:|vinscant:|vinvoor:|zess:) ]]; then + echo $message + echo "Error: commit message should start with vingo:|vinscant:|vinvoor:|zess: depending on which subproject you are working on." + exit 1 + fi + + if ! [[ $message =~ ^.*:\ [a-z].* ]]; then + echo $message + echo "Error: first letter after project specifier should be lower case" + exit 1 + fi + done diff --git a/README.md b/README.md index 06b6f1c..2becebb 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,17 @@ # Zeus Scan Syst(e)em -_Formerly called Vincent_ +_Formerly called Vincent (I did not name it - Vincent)_ Check-in in the the kelder kelder -(Will) scan a badge at the scanner (vinscant) which registers its serial number at the webserver (vingo). +Scans a badge at the scanner (vinscant) which registers its serial number at the webserver (vingo). + +Features: + +- Supports a daily check-in, keeping track of which days you have visited the kelder. Goals: -- Support a check-in a day, keeping track of which days you have visited the kelder - Support check-in and check-out, keeping track of how many hours(, minutes(, seconds)) you have been in the kelder - Cool stats :D diff --git a/vingo/database/scans.go b/vingo/database/scans.go index efffdf7..74219c4 100644 --- a/vingo/database/scans.go +++ b/vingo/database/scans.go @@ -72,7 +72,7 @@ func GetPresenceHistory(user_id int) ([]Present, error) { ON ds.date = scans.scan_date LEFT JOIN days ON ds.date = days.date - ORDER BY ds.date; + ORDER BY ds.date DESC; `, user_id) if err != nil { return nil, err diff --git a/vingo/layouts/cards.html b/vingo/layouts/cards.html index 2e553ec..db2ed35 100644 --- a/vingo/layouts/cards.html +++ b/vingo/layouts/cards.html @@ -1,39 +1,39 @@
- If you don't have any cards yet, click the button below to start registering a new card. + If you don't have any cards yet, click the button below to start registering a new card.
Once clicked, you will have 1 minute to scan the card you want to use at the scanner and it will be linked to your account.
-
- {{if .registering}} +
+ {{ if .registering }} {{ if .reg_user }} - - {{- else}} - - {{- end}} - {{- else}} - - {{- end}} + + {{ else }} + + {{ end }} + {{ else }} + + {{ end }}
- {{if .cards}} - - + {{ if .cards }} +
+ + + + + + + {{ range .cards }} - - + + - - {{range .cards}} - - - - - {{end}} -
cardcreated_at
cardcreated_at{{ .Serial }}{{ .CreatedAt.Local.Format "2 January 2006 15:04:05" }}
{{.Serial}}{{.CreatedAt.Local.Format "2 January 2006 15:04:05"}}
- {{- else}} -
No cards yet!
- {{- end}} + {{ end }} + + {{ else }} +

No cards yet!

+ {{ end }}
\ No newline at end of file diff --git a/vingo/layouts/days.html b/vingo/layouts/days.html index ee2bd59..87be5ef 100644 --- a/vingo/layouts/days.html +++ b/vingo/layouts/days.html @@ -14,26 +14,26 @@
- {{if .days}} - - - - - - - - {{range .days}} - - - - - {{end}} -
datedelete
{{.Date.Format "Mon 2 January 2006"}} -
- -
-
- {{- else}} -
No days yet!
- {{- end}} + {{ if .days }} + + + + + + + + {{ range .days }} + + + + + {{ end }} +
datedelete
{{ .Date.Format "Mon 2 January 2006" }} +
+ +
+
+ {{ else }} +

No days yet!

+ {{ end }}
\ No newline at end of file diff --git a/vingo/layouts/landing.html b/vingo/layouts/landing.html index 12a54e8..588e664 100644 --- a/vingo/layouts/landing.html +++ b/vingo/layouts/landing.html @@ -1 +1 @@ -
Ono you are not logged in!
\ No newline at end of file +

Ono you are not logged in!

\ No newline at end of file diff --git a/vingo/layouts/leaderboard.html b/vingo/layouts/leaderboard.html index 7030e57..5925445 100644 --- a/vingo/layouts/leaderboard.html +++ b/vingo/layouts/leaderboard.html @@ -1,5 +1,5 @@
- +
@@ -7,12 +7,12 @@ - {{range .leaderboard}} - - - - - - {{end}} + {{ range .leaderboard }} + + + + + + {{ end }}
#Total days scanned
{{.Position}}{{.Username}}{{.TotalDays}}
{{.Position}}{{.Username}}{{.TotalDays}}
\ No newline at end of file diff --git a/vingo/layouts/main.html b/vingo/layouts/main.html index 8b74435..a1719f4 100644 --- a/vingo/layouts/main.html +++ b/vingo/layouts/main.html @@ -4,13 +4,168 @@ ZeSS - + - {{template "partials/navbar" .}} -
- {{embed}} + {{ template "partials/navbar" . }} +
+ {{ embed }}
- \ No newline at end of file + diff --git a/vingo/layouts/partials/navbar.html b/vingo/layouts/partials/navbar.html index 79321f3..84ce78d 100644 --- a/vingo/layouts/partials/navbar.html +++ b/vingo/layouts/partials/navbar.html @@ -1,37 +1,43 @@ -