Skip to content
Snippets Groups Projects
Commit a346e83b authored by Sandro Santilli's avatar Sandro Santilli
Browse files

Update issue count only once

parent a5c90c8b
No related branches found
No related tags found
No related merge requests found
......@@ -213,6 +213,7 @@ FROM ticket t order by id`)
if err != nil {
log.Fatal(err)
}
count := 0;
for rows.Next() {
var id, cre int64
var comp, typ, sev, pri, own, rep, ver, mlst, stat, res, sum, desc string
......@@ -221,10 +222,20 @@ FROM ticket t order by id`)
log.Fatal(err)
}
fmt.Println("Adding ticket", id, " - ", sum)
count++;
addTicket(gogsdb, gogsRepoId, id, typ, cre, comp, sev, pri, own,
rep, ver, mlst, stat == "closed", res, sum, desc)
}
// Update issue count for repo
if count > 0 {
_, err = gogsdb.Exec(`UPDATE repository SET num_issues = num_issues+$1
WHERE id = $2`, count, gogsRepoId)
if err != nil {
log.Fatal(err)
}
}
}
func tracTextToMarkdown(in string) string {
......@@ -393,13 +404,6 @@ false, $7, $8, $9 RETURNING id`,
addIssueLabel(db, repoID, gid, lbl)
}
// Update issue count for repo
_, err = db.Exec(`UPDATE repository SET num_issues = num_issues+1
WHERE id = $1`, repoID)
if err != nil {
log.Fatal(err)
}
// Add tickets comments
rows, err := tracdb.Query(`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment