🚑 Remove recursive db loading and fix a small bug ith the broadcast command
This commit is contained in:
parent
474744f928
commit
fdb6eccb40
@ -30,7 +30,7 @@ func (i infoCommand) ExecuteCommand(bot *tgbotapi.BotAPI, update *tgbotapi.Updat
|
|||||||
"General Information to this Bot\n" +
|
"General Information to this Bot\n" +
|
||||||
"===============================\n" +
|
"===============================\n" +
|
||||||
"Developer: @Alphyron\n" +
|
"Developer: @Alphyron\n" +
|
||||||
"Version: 2.2.2\n" +
|
"Version: 2.2.4\n" +
|
||||||
"Git: [Gitea Repository](https://git.dragon-labs.de/alphyron/group_assistant)\n" +
|
"Git: [Gitea Repository](https://git.dragon-labs.de/alphyron/group_assistant)\n" +
|
||||||
"==============================="
|
"==============================="
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ func (g groupHelperRepository) GetGroupByID(id int64) (*models.Group, error) {
|
|||||||
defaultGroup.FillDefaultValues()
|
defaultGroup.FillDefaultValues()
|
||||||
defaultGroup.GroupID = id
|
defaultGroup.GroupID = id
|
||||||
|
|
||||||
err := g.Conn.Set("gorm:auto_preload", true).Where("group_id = ?", id).First(&group)
|
err := g.Conn.Preload("ControlledGroups").Where("group_id = ?", id).First(&group)
|
||||||
|
|
||||||
if err.RecordNotFound() {
|
if err.RecordNotFound() {
|
||||||
return g.CreateGroup(defaultGroup)
|
return g.CreateGroup(defaultGroup)
|
||||||
@ -214,7 +214,7 @@ func (g groupHelperRepository) GetGroupByDBID(id uint64) (*models.Group, error)
|
|||||||
defaultGroup.FillDefaultValues()
|
defaultGroup.FillDefaultValues()
|
||||||
defaultGroup.ID = id
|
defaultGroup.ID = id
|
||||||
|
|
||||||
err := g.Conn.Set("gorm:auto_preload", true).Where("id = ?", id).First(&group)
|
err := g.Conn.Preload("ControlledGroups").Where("id = ?", id).First(&group)
|
||||||
|
|
||||||
if err.RecordNotFound() {
|
if err.RecordNotFound() {
|
||||||
return g.CreateGroup(defaultGroup)
|
return g.CreateGroup(defaultGroup)
|
||||||
|
Loading…
Reference in New Issue
Block a user