Skip to content

Commit 8fd13c5

Browse files
committed
shows how many people voted so far
1 parent 1bcb591 commit 8fd13c5

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

eboard.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,16 @@ func HandleGetEboardVote(c *gin.Context) {
2323
if votes == nil {
2424
votes = make(map[string]float32)
2525
}
26+
if voters == nil {
27+
voters = []string{}
28+
}
2629
fmt.Println(votes)
2730
c.HTML(http.StatusOK, "eboard.tmpl", gin.H{
28-
"Username": user,
29-
"Voted": slices.Contains(voters, user.Username),
30-
"Results": votes,
31-
"Options": OPTIONS,
31+
"Username": user,
32+
"Voted": slices.Contains(voters, user.Username),
33+
"Results": votes,
34+
"VoteCount": len(voters),
35+
"Options": OPTIONS,
3236
})
3337
}
3438

templates/eboard.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
{{ template "nav" . }}
1515
<div class="container main p-5">
1616
<h2>E-Board Vote</h2>
17+
<span>Current Votes Submitted: {{ .VoteCount }}</span>
1718
<div class="row">
1819
<div class="col-md-8">
1920
{{ if .Voted }}

0 commit comments

Comments
 (0)