66 "html/template"
77 "net/http"
88 "os"
9+ "slices"
910 "sort"
1011 "strconv"
1112 "strings"
@@ -152,7 +153,7 @@ func main() {
152153 poll .Options = []string {"Fail" , "Conditional" , "Abstain" }
153154 case "custom" :
154155 poll .Options = []string {}
155- for _ , opt := range strings .Split (c .PostForm ("customOptions" ), "," ) {
156+ for opt := range strings .SplitSeq (c .PostForm ("customOptions" ), "," ) {
156157 poll .Options = append (poll .Options , strings .TrimSpace (opt ))
157158 if ! containsString (poll .Options , "Abstain" ) && (poll .VoteType == database .POLL_TYPE_SIMPLE ) {
158159 poll .Options = append (poll .Options , "Abstain" )
@@ -162,6 +163,12 @@ func main() {
162163 default :
163164 poll .Options = []string {"Pass" , "Fail" , "Abstain" }
164165 }
166+ if poll .Gatekeep {
167+ poll .WaivedUsers = []string {}
168+ for user := range strings .SplitSeq (c .PostForm ("waivedUsers" ), "," ) {
169+ poll .WaivedUsers = append (poll .WaivedUsers , strings .TrimSpace (user ))
170+ }
171+ }
165172
166173 pollId , err := database .CreatePoll (c , poll )
167174 if err != nil {
@@ -528,7 +535,10 @@ type Result struct {
528535 T_Seminars int `json:"t_seminars"`
529536}
530537
531- func canVote (groups []string , username string , gatekeepEnforcedPoll bool ) bool {
538+ func canVote (groups []string , username string , gatekeepEnforcedPoll bool , waivedUsers []string ) bool {
539+ if slices .Contains (waivedUsers , username ) {
540+ return true
541+ }
532542 var active , fallCoop , springCoop bool
533543 for _ , group := range groups {
534544 if group == "active" {
0 commit comments