diff --git a/constitutional.go b/constitutional.go index 4fc412c..20805f3 100644 --- a/constitutional.go +++ b/constitutional.go @@ -106,7 +106,7 @@ func EvaluatePolls() { // check all voters to see if they have voted if poll.AllowedUsers == nil { logging.Logger.WithFields(logrus.Fields{"method": "EvaluatePolls checkQuorum"}).Error( - "Users allowed to vote is nil for \"" + poll.ShortDescription + "\" !! This should not happen!!") + "Users allowed to vote is nil for \"" + poll.Title + "\" !! This should not happen!!") continue } for _, user := range poll.AllowedUsers { @@ -128,7 +128,7 @@ func EvaluatePolls() { oidcClient.GetUserInfo(user) _, _, err = slackData.Client.PostMessage(user.SlackUID, slack.MsgOptionText( - "Hello, you have not yet voted on \""+poll.ShortDescription+"\". We have not yet hit quorum"+ + "Hello, you have not yet voted on \""+poll.Title+"\". We have not yet hit quorum"+ " and we need YOU :index_pointing_at_the_viewer: to complete your responsibility as a "+ "member of house and vote. \n"+pollLink+"\nThank you!", false)) if err != nil { @@ -144,12 +144,12 @@ func EvaluatePolls() { } // we close the poll here err = poll.Close(ctx) - fmt.Println("Time reached, closing poll " + poll.ShortDescription) + fmt.Println("Time reached, closing poll " + poll.Title) if err != nil { logging.Logger.WithFields(logrus.Fields{"method": "EvaluatePolls close"}).Error(err) continue } - announceStr := "The vote \"" + poll.ShortDescription + "\" has closed." + announceStr := "The vote \"" + poll.Title + "\" has closed." if !poll.Hidden { announceStr += " Check out the results at " + pollLink } else { diff --git a/database/poll.go b/database/poll.go index 63bb12c..7df45fc 100644 --- a/database/poll.go +++ b/database/poll.go @@ -16,18 +16,18 @@ import ( ) type Poll struct { - Id string `bson:"_id,omitempty"` - CreatedBy string `bson:"createdBy"` - ShortDescription string `bson:"shortDescription"` - LongDescription string `bson:"longDescription"` - VoteType string `bson:"voteType"` - Options []string `bson:"options"` - OpenedTime time.Time `bson:"openedTime"` - Open bool `bson:"open"` - Gatekeep bool `bson:"gatekeep"` - QuorumType float64 `bson:"quorumType"` - AllowedUsers []string `bson:"allowedUsers"` - AllowWriteIns bool `bson:"writeins"` + Id string `bson:"_id,omitempty"` + CreatedBy string `bson:"createdBy"` + Title string `bson:"title"` + Description string `bson:"description"` + VoteType string `bson:"voteType"` + Options []string `bson:"options"` + OpenedTime time.Time `bson:"openedTime"` + Open bool `bson:"open"` + Gatekeep bool `bson:"gatekeep"` + QuorumType float64 `bson:"quorumType"` + AllowedUsers []string `bson:"allowedUsers"` + AllowWriteIns bool `bson:"writeins"` // Prevent this poll from having progress displayed // This is important for events like elections where the results shouldn't be visible mid vote diff --git a/main.go b/main.go index cccf7dc..7e9239e 100644 --- a/main.go +++ b/main.go @@ -204,17 +204,17 @@ func main() { } poll := &database.Poll{ - Id: "", - CreatedBy: claims.UserInfo.Username, - ShortDescription: c.PostForm("shortDescription"), - LongDescription: c.PostForm("longDescription"), - VoteType: database.POLL_TYPE_SIMPLE, - OpenedTime: time.Now(), - Open: true, - QuorumType: float64(quorum), - Gatekeep: c.PostForm("gatekeep") == "true", - AllowWriteIns: c.PostForm("allowWriteIn") == "true", - Hidden: c.PostForm("hidden") == "true", + Id: "", + CreatedBy: claims.UserInfo.Username, + Title: c.PostForm("title"), + Description: c.PostForm("description"), + VoteType: database.POLL_TYPE_SIMPLE, + OpenedTime: time.Now(), + Open: true, + QuorumType: float64(quorum), + Gatekeep: c.PostForm("gatekeep") == "true", + AllowWriteIns: c.PostForm("allowWriteIn") == "true", + Hidden: c.PostForm("hidden") == "true", } if c.PostForm("rankedChoice") == "true" { poll.VoteType = database.POLL_TYPE_RANKED @@ -286,16 +286,16 @@ func main() { canModify := containsString(claims.UserInfo.Groups, "active_rtp") || containsString(claims.UserInfo.Groups, "eboard") || poll.CreatedBy == claims.UserInfo.Username c.HTML(200, "poll.tmpl", gin.H{ - "Id": poll.Id, - "ShortDescription": poll.ShortDescription, - "LongDescription": poll.LongDescription, - "Options": poll.Options, - "PollType": poll.VoteType, - "RankedMax": fmt.Sprint(len(poll.Options) + writeInAdj), - "AllowWriteIns": poll.AllowWriteIns, - "CanModify": canModify, - "Username": claims.UserInfo.Username, - "FullName": claims.UserInfo.FullName, + "Id": poll.Id, + "Title": poll.Title, + "Description": poll.Description, + "Options": poll.Options, + "PollType": poll.VoteType, + "RankedMax": fmt.Sprint(len(poll.Options) + writeInAdj), + "AllowWriteIns": poll.AllowWriteIns, + "CanModify": canModify, + "Username": claims.UserInfo.Username, + "FullName": claims.UserInfo.FullName, }) })) @@ -453,8 +453,8 @@ func main() { votesNeededForQuorum := int(poll.QuorumType * float64(len(poll.AllowedUsers))) c.HTML(200, "result.tmpl", gin.H{ "Id": poll.Id, - "ShortDescription": poll.ShortDescription, - "LongDescription": poll.LongDescription, + "Title": poll.Title, + "Description": poll.Description, "VoteType": poll.VoteType, "Results": results, "IsOpen": poll.Open, diff --git a/templates/closed.tmpl b/templates/closed.tmpl index c0a02f9..6d76647 100644 --- a/templates/closed.tmpl +++ b/templates/closed.tmpl @@ -35,7 +35,7 @@ href="/results/{{ $poll.Id }}" > - {{ $poll.ShortDescription }} + {{ $poll.Title }}
diff --git a/templates/index.tmpl b/templates/index.tmpl index 6eef6f8..c18468c 100644 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -40,7 +40,7 @@ href="/poll/{{ $poll.Id }}" > - {{ $poll.ShortDescription }} + {{ $poll.Title }} -

{{ .ShortDescription }}

- {{ if .LongDescription }} -

{{ .LongDescription | MakeLinks }}

+

{{ .Title }}

+ {{ if .Description }} +

{{ .Description | MakeLinks }}

{{ end }} {{ if eq .PollType "ranked" }}

This is a Ranked Choice vote. Rank the candidates in order of your preference. 1 is most preferred, and {{ .RankedMax }} is least perferred. You may leave an option blank diff --git a/templates/result.tmpl b/templates/result.tmpl index 0ec7944..acbe0a4 100644 --- a/templates/result.tmpl +++ b/templates/result.tmpl @@ -50,9 +50,9 @@

{{ end }} -

{{ .ShortDescription }}

- {{ if .LongDescription }} -

{{ .LongDescription | MakeLinks }}

+

{{ .Title }}

+ {{ if .Description }} +

{{ .Description | MakeLinks }}

{{ end }}