frontend: allow players to respond to issues
This commit is contained in:
parent
73eb3ab1c0
commit
edbac43423
8 changed files with 85 additions and 12 deletions
|
|
@ -2,6 +2,7 @@ package fic
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"path"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
|
@ -43,6 +44,12 @@ func GetClaims() (res []Claim, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
// GetClaim retrieves the claim with the given identifier and registered for the given Team.
|
||||
func (t Team) GetClaim(id int64) (c Claim, err error) {
|
||||
err = DBQueryRow("SELECT id_claim, subject, id_team, id_exercice, id_assignee, creation, state, priority FROM claims WHERE id_claim = ? AND id_team = ?", id, t.Id).Scan(&c.Id, &c.Subject, &c.IdTeam, &c.IdExercice, &c.IdAssignee, &c.Creation, &c.State, &c.Priority)
|
||||
return
|
||||
}
|
||||
|
||||
// GetClaims returns a list of all Claim registered for the Team.
|
||||
func (t Team) GetClaims() (res []Claim, err error) {
|
||||
var rows *sql.Rows
|
||||
|
|
@ -357,8 +364,10 @@ type teamIssueText struct {
|
|||
}
|
||||
|
||||
type teamIssueFile struct {
|
||||
Id int64 `json:"id"`
|
||||
Subject string `json:"subject"`
|
||||
Exercice *string `json:"exercice,omitempty"`
|
||||
ExerciceURL string `json:"url,omitempty"`
|
||||
Assignee *string `json:"assignee,omitempty"`
|
||||
State string `json:"state"`
|
||||
Priority string `json:"priority"`
|
||||
|
|
@ -370,9 +379,13 @@ func (t Team) MyIssueFile() (ret []teamIssueFile, err error) {
|
|||
if claims, err = t.GetClaims(); err == nil {
|
||||
for _, claim := range claims {
|
||||
var exercice *string = nil
|
||||
var url string
|
||||
|
||||
if exo, err := claim.GetExercice(); err == nil && exo != nil {
|
||||
exercice = &exo.Title
|
||||
if theme, err := GetTheme(exo.IdTheme); err == nil {
|
||||
url = path.Join(theme.URLId, exo.URLId)
|
||||
}
|
||||
}
|
||||
|
||||
var assignee *string = nil
|
||||
|
|
@ -384,8 +397,10 @@ func (t Team) MyIssueFile() (ret []teamIssueFile, err error) {
|
|||
return nil, err
|
||||
} else {
|
||||
tif := teamIssueFile{
|
||||
Id: claim.Id,
|
||||
Subject: claim.Subject,
|
||||
Exercice: exercice,
|
||||
ExerciceURL: url,
|
||||
Assignee: assignee,
|
||||
State: claim.State,
|
||||
Priority: claim.Priority,
|
||||
|
|
|
|||
Reference in a new issue