diff options
author | Galen Guyer <galen@galenguyer.com> | 2022-08-11 12:20:29 -0400 |
---|---|---|
committer | Galen Guyer <galen@galenguyer.com> | 2022-08-11 12:20:29 -0400 |
commit | 6168aff1c4cbeb0ab4858794c0a5bb21157be905 (patch) | |
tree | 5038abcc0a922179ead8184a3445a96567d132cc | |
parent | 39fa49a8389aa220cec3c249f2d09167b2556ded (diff) |
update readme with what I've just done
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | main.go | 21 |
2 files changed, 11 insertions, 16 deletions
@@ -6,7 +6,7 @@ Imagine this. You're a somehow still functioning student organization of compute Anyways, now we can vote online. It's cool, I guess? We have things such as: - **Server-side rendering**. That's right, this site (should) (mostly) work without JavaScript. - **Server Sent Events** for real-time vote results - - **Limited voting options**. It's worse than Google Forms! (See To-Dos. I hope to change that someday(tm)) + - **(Slightly less) limited voting options**. It's worse than Google Forms! (See To-Dos. All that's left now is ranked choice voting) ## Configuration You'll need to set up these values in your environment. Ask an RTP for OIDC credentials. A docker-compose file is provided for convenience. Otherwise, I trust you to figure it out! @@ -20,6 +20,6 @@ VOTE_STATE= ``` ## To-Dos -- [ ] Custom vote options -- [ ] Write-in votes +- [x] Custom vote options +- [x] Write-in votes - [ ] Ranked choice voting @@ -191,22 +191,17 @@ func main() { return } - var vote database.Vote + vote := database.Vote{ + Id: "", + PollId: pId, + UserId: claims.UserInfo.Username, + Option: c.PostForm("option"), + } if hasOption(poll, c.PostForm("option")) { - vote = database.Vote{ - Id: "", - PollId: pId, - UserId: claims.UserInfo.Username, - Option: c.PostForm("option"), - } + vote.Option = c.PostForm("option") } else if poll.AllowWriteIns && c.PostForm("option") == "writein" { - vote = database.Vote{ - Id: "", - PollId: pId, - UserId: claims.UserInfo.Username, - Option: c.PostForm("writeinOption"), - } + vote.Option = c.PostForm("writeinOption") } else { c.JSON(500, gin.H{"error": "Invalid Option"}) return |