admin: improve claims with related exercices
This commit is contained in:
parent
2e3f7c6894
commit
32dc9c1a8c
5 changed files with 91 additions and 11 deletions
|
|
@ -46,7 +46,27 @@ func GetClaims() (res []Claim, err error) {
|
|||
// GetClaims returns a list of all Claim registered for the Team.
|
||||
func (t Team) GetClaims() (res []Claim, err error) {
|
||||
var rows *sql.Rows
|
||||
if rows, err = DBQuery("SELECT id_claim, subject, id_team, id_exercice, id_assignee, creation, state, priority FROM claims WHERE IdTeam = ?", t.Id); err != nil {
|
||||
if rows, err = DBQuery("SELECT id_claim, subject, id_team, id_exercice, id_assignee, creation, state, priority FROM claims WHERE id_team = ?", t.Id); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
for rows.Next() {
|
||||
var c Claim
|
||||
if err = rows.Scan(&c.Id, &c.Subject, &c.IdTeam, &c.IdExercice, &c.IdAssignee, &c.Creation, &c.State, &c.Priority); err != nil {
|
||||
return
|
||||
}
|
||||
res = append(res, c)
|
||||
}
|
||||
err = rows.Err()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetExercices returns a list of all Claim registered for the Exercice.
|
||||
func (e Exercice) GetClaims() (res []Claim, err error) {
|
||||
var rows *sql.Rows
|
||||
if rows, err = DBQuery("SELECT id_claim, subject, id_team, id_exercice, id_assignee, creation, state, priority FROM claims WHERE id_exercice = ?", e.Id); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
|
|
|
|||
Reference in a new issue