Skip to content

Commit

Permalink
Merge branch 'main' into vinvoor
Browse files Browse the repository at this point in the history
  • Loading branch information
Topvennie authored Jun 11, 2024
2 parents 163a6aa + 74151e4 commit 131d3cf
Show file tree
Hide file tree
Showing 15 changed files with 407 additions and 182 deletions.
19 changes: 19 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions .github/workflows/commit_message_check.yml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion vingo/database/scans.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
52 changes: 26 additions & 26 deletions vingo/layouts/cards.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<div class="box">
<form action="/cards/register" method="post">
<div>
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.<br/>
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.
</div>
<div class="field is-grouped is-grouped-right">
{{if .registering}}
<div>
{{ if .registering }}
{{ if .reg_user }}
<input class="button is-warning" disabled type="submit" value="You are registering a card!">
{{- else}}
<input class="button is-danger" disabled type="submit" value="Somebody is already registering a card">
{{- end}}
{{- else}}
<input class="button is-success" type="submit" value="Start registering a new card">
{{- end}}
<input class="warning" disabled type="submit" value="You are registering a card!">
{{ else }}
<input class="danger" disabled type="submit" value="Somebody is already registering a card">
{{ end }}
{{ else }}
<input class="success" type="submit" value="Start registering a new card">
{{ end }}
</div>
</form>
</div>
<div class="box">
{{if .cards}}
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
{{ if .cards }}
<table>
<thead>
<tr>
<th>card</th>
<th>created_at</th>
</tr>
</thead>
{{ range .cards }}
<tr>
<th>card</th>
<th>created_at</th>
<td>{{ .Serial }}</td>
<td>{{ .CreatedAt.Local.Format "2 January 2006 15:04:05" }}</td>
</tr>
</thead>
{{range .cards}}
<tr>
<td>{{.Serial}}</td>
<td>{{.CreatedAt.Local.Format "2 January 2006 15:04:05"}}</td>
</tr>
{{end}}
</table>
{{- else}}
<div class="title">No cards yet!</div>
{{- end}}
{{ end }}
</table>
{{ else }}
<h1>No cards yet!</h1>
{{ end }}
</div>
44 changes: 22 additions & 22 deletions vingo/layouts/days.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@
</form>
</div>
<div class="box">
{{if .days}}
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th>date</th>
<th>delete</th>
</tr>
</thead>
{{range .days}}
<tr>
<td>{{.Date.Format "Mon 2 January 2006"}}</td>
<td>
<form action="/days/{{ .Id }}" method="post">
<input type="submit" class="is-danger" value="Delete">
</form>
</td>
</tr>
{{end}}
</table>
{{- else}}
<div class="title">No days yet!</div>
{{- end}}
{{ if .days }}
<table>
<thead>
<tr>
<th>date</th>
<th>delete</th>
</tr>
</thead>
{{ range .days }}
<tr>
<td>{{ .Date.Format "Mon 2 January 2006" }}</td>
<td>
<form action="/days/{{ .Id }}" method="post">
<input type="submit" class="danger" value="Delete">
</form>
</td>
</tr>
{{ end }}
</table>
{{ else }}
<h1>No days yet!</h1>
{{ end }}
</div>
2 changes: 1 addition & 1 deletion vingo/layouts/landing.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<div class="title">Ono you are not logged in!</div>
<h1>Ono you are not logged in!</h1>
16 changes: 8 additions & 8 deletions vingo/layouts/leaderboard.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<div class="box">
<table class="table is-fullwidth is-striped is-hoverable">
<table>
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Total days scanned</th>
</tr>
</thead>
{{range .leaderboard}}
<tr>
<td>{{.Position}}</td>
<td>{{.Username}}</td>
<td>{{.TotalDays}}</td>
</tr>
{{end}}
{{ range .leaderboard }}
<tr>
<td>{{.Position}}</td>
<td>{{.Username}}</td>
<td>{{.TotalDays}}</td>
</tr>
{{ end }}
</table>
</div>
Loading

0 comments on commit 131d3cf

Please sign in to comment.