Add Vetoing Suggestors report
This commit is contained in:
parent
2570a07d57
commit
b578f3250d
@ -68,6 +68,7 @@ module.exports = React.createClass({
|
||||
<MenuItem eventKey="suggestors">Suggestor Frequency</MenuItem>
|
||||
<MenuItem eventKey="winning-suggestors">Winning Suggestors</MenuItem>
|
||||
<MenuItem eventKey="vetoed-suggestors">Vetoed Suggestors</MenuItem>
|
||||
<MenuItem eventKey="vetoing-suggestors">Vetoing Suggestors</MenuItem>
|
||||
<MenuItem eventKey="suggestor-veto-ratio">Suggestor Veto Ratio</MenuItem>
|
||||
</DropdownButton>
|
||||
</ButtonGroup>
|
||||
|
20
reports.go
20
reports.go
@ -135,6 +135,17 @@ func GetWinningSuggestors(groupid int64) (*[]*Attendee, error) {
|
||||
return &suggestors, nil
|
||||
}
|
||||
|
||||
func GetVetoingSuggestors(groupid int64) (*[]*Attendee, error) {
|
||||
var suggestors []*Attendee
|
||||
|
||||
_, err := DB.Select(&suggestors, "SELECT attendees.* FROM attendees INNER JOIN suggestions ON suggestions.AttendeeId==attendees.AttendeeId WHERE suggestions.VetoingId!=-1 AND suggestions.GroupId=?", groupid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &suggestors, nil
|
||||
}
|
||||
|
||||
func ReportHandler(w http.ResponseWriter, r *http.Request) {
|
||||
user, err := GetUserFromSession(r)
|
||||
if err != nil {
|
||||
@ -203,6 +214,15 @@ func ReportHandler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
report.FromSummedAttendeeList(attendees)
|
||||
} else if reportid == "vetoing-suggestors" {
|
||||
report.Title = "Vetoing Suggestors"
|
||||
attendees, err := GetVetoingSuggestors(user.GroupId)
|
||||
if err != nil {
|
||||
WriteError(w, 999 /*Internal Error*/)
|
||||
log.Print(err)
|
||||
return
|
||||
}
|
||||
report.FromSummedAttendeeList(attendees)
|
||||
} else if reportid == "suggestors" {
|
||||
report.Title = "Suggestor Frequency"
|
||||
attendees, err := GetAllSuggestors(user.GroupId)
|
||||
|
Loading…
Reference in New Issue
Block a user