Skip to content

Commit

Permalink
Minor form fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
frikky committed Nov 19, 2024
1 parent 352e08f commit c02e2ac
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -20206,7 +20206,13 @@ func PrepareWorkflowExecution(ctx context.Context, workflow Workflow, request *h
log.Printf("[ERROR] Failed unmarshalling userinput note: %s", err)
}

missingFields := []string{}
for _, actualQuestion := range actualQuestions {

if strings.Contains(actualQuestion.Value, ";") {
actualQuestion.Value = strings.Split(actualQuestion.Value, ";")[0]
}

/*
// FIXME: Required check here
if actualQuestion.Required == false {
Expand All @@ -20228,9 +20234,13 @@ func PrepareWorkflowExecution(ctx context.Context, workflow Workflow, request *h
}

if !found {
return *oldExecution, ExecInfo{}, "Answer all questions first.", errors.New("Answer all questions first")
missingFields = append(missingFields, actualQuestion.Value)
}
}

if len(missingFields) > 0 {
return *oldExecution, ExecInfo{}, "Answer all questions first.", errors.New(fmt.Sprintf("Answer all questions: %s", strings.Join(missingFields, ", ")))
}
}
}

Expand Down Expand Up @@ -29591,7 +29601,7 @@ func HandleGetOrgForms(resp http.ResponseWriter, request *http.Request) {
}

if len(relevantForms) == 0 {
log.Printf("[INFO] No forms found for user %s (%s) in org %s (%s)", randomUser.Username, randomUser.Id, randomUser.ActiveOrg.Name, randomUser.ActiveOrg.Id)
log.Printf("[INFO] No forms found for user '%s' (%s) in org %s (%s)", randomUser.Username, randomUser.Id, randomUser.ActiveOrg.Name, randomUser.ActiveOrg.Id)
resp.WriteHeader(200)
resp.Write([]byte("[]"))
return
Expand Down

0 comments on commit c02e2ac

Please sign in to comment.