Skip to content

Commit

Permalink
Update Template.go
Browse files Browse the repository at this point in the history
  • Loading branch information
nfsprodriver authored Jun 13, 2023
1 parent 763bd6e commit d589598
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions db/Template.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,19 @@ func FillTemplate(d Store, template *Template) (err error) {
if err != nil {
return
}

if template.SurveyVarsJSON != nil {
err = json.Unmarshal([]byte(*template.SurveyVarsJSON), &template.SurveyVars)
}

var tasks []TaskWithTpl
tasks, err = d.GetTemplateTasks(template.ProjectID, template.ID, RetrieveQueryParams{Count: 1})
if err != nil {
return
tasks, err = d.GetTemplateTasks(template.ProjectID, template.ID, RetrieveQueryParams{Count: 1})
}
if len(tasks) > 0 {
template.LastTask = &tasks[0]
}

if template.SurveyVarsJSON != nil {
err = json.Unmarshal([]byte(*template.SurveyVarsJSON), &template.SurveyVars)
}

return
}

0 comments on commit d589598

Please sign in to comment.