frontend: display issues related to the team

This commit is contained in:
nemunaire 2020-01-23 16:03:31 +01:00
parent 7bec409ab8
commit a3ffdeae17
12 changed files with 238 additions and 12 deletions

View file

@ -96,6 +96,27 @@ func consumer() {
}
}
// Generate issues.json for a given team
func genTeamIssuesFile(team fic.Team) error {
dirPath := path.Join(TeamsDir, fmt.Sprintf("%d", team.Id))
if s, err := os.Stat(dirPath); os.IsNotExist(err) {
os.MkdirAll(dirPath, 0777)
} else if !s.IsDir() {
return errors.New(fmt.Sprintf("%s is not a directory", dirPath))
}
if my, err := team.MyIssueFile(); err != nil {
return err
} else if j, err := json.Marshal(my); err != nil {
return err
} else if err = ioutil.WriteFile(path.Join(dirPath, "issues.json"), j, 0644); err != nil {
return err
}
return nil
}
// Generate my.json and wait.json for a given team
func genTeamMyFile(team *fic.Team) error {
dirPath := path.Join(TeamsDir, fmt.Sprintf("%d", team.Id))

View file

@ -44,7 +44,7 @@ func treatIssue(pathname string, team fic.Team) {
if claim, err := fic.NewClaim(issue.Subject, &team, exercice, nil, "medium"); err != nil {
log.Printf("%s [ERR] Unable to create new issue: %s\n", id, err)
} else if len(issue.Description) > 0 {
if _, err := claim.AddDescription(issue.Description, fic.ClaimAssignee{Id: 0}); err != nil {
if _, err := claim.AddDescription(issue.Description, fic.ClaimAssignee{Id: 0}, true); err != nil {
log.Printf("%s [WRN] Unable to add description to issue: %s\n", id, err)
} else {
log.Printf("%s [OOK] New issue created: id=%d\n", id, claim.Id)
@ -53,5 +53,6 @@ func treatIssue(pathname string, team fic.Team) {
}
}
}
genTeamIssuesFile(team)
}
}