fix(be): remove recursive call in BoltDB method

This commit is contained in:
Denis Gukov 2022-01-29 14:14:42 +05:00
parent db252379c0
commit 8516e31415
2 changed files with 8 additions and 3 deletions

View File

@ -57,9 +57,9 @@ func (d *BoltDb) getTasks(projectID int, templateID *int, params db.RetrieveQuer
tpl, ok := templates[task.TemplateID]
if !ok {
if templateID == nil {
tpl, _ = d.GetTemplate(task.ProjectID, task.TemplateID)
tpl, _ = d.getRawTemplate(task.ProjectID, task.TemplateID)
} else {
tpl, _ = d.GetTemplate(task.ProjectID, *templateID)
tpl, _ = d.getRawTemplate(task.ProjectID, *templateID)
}
templates[task.TemplateID] = tpl
}

View File

@ -59,8 +59,13 @@ func (d *BoltDb) GetTemplates(projectID int, filter db.TemplateFilter, params db
return
}
func (d *BoltDb) GetTemplate(projectID int, templateID int) (template db.Template, err error) {
func (d *BoltDb) getRawTemplate(projectID int, templateID int) (template db.Template, err error) {
err = d.getObject(projectID, db.TemplateProps, intObjectID(templateID), &template)
return
}
func (d *BoltDb) GetTemplate(projectID int, templateID int) (template db.Template, err error) {
template, err = d.getRawTemplate(projectID, templateID)
if err != nil {
return
}