mirror of
https://github.com/ChronosX88/yans.git
synced 2024-12-21 22:21:46 +00:00
Make assigning new article number bound to a group
This commit is contained in:
parent
7d5d277a1f
commit
564947e75c
@ -119,7 +119,7 @@ func (sb *SQLiteBackend) SaveArticle(a models.Article, groups []string) error {
|
||||
}
|
||||
|
||||
for _, v := range groupIDs {
|
||||
_, err = sb.db.Exec("INSERT INTO articles_to_groups (article_id, article_number, group_id) VALUES (?, (SELECT ifnull(max(article_number)+1, 1) FROM articles_to_groups), ?)", articleID, v)
|
||||
_, err = sb.db.Exec("INSERT INTO articles_to_groups (article_id, article_number, group_id) VALUES (?, (SELECT ifnull(max(article_number)+1, 1) FROM articles_to_groups WHERE group_id = ?), ?)", articleID, v, v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user