diff --git a/core/models/runs.go b/core/models/runs.go index 12f81e5cf..3c8932309 100644 --- a/core/models/runs.go +++ b/core/models/runs.go @@ -11,6 +11,7 @@ import ( "github.com/nyaruka/gocommon/jsonx" "github.com/nyaruka/goflow/flows" "github.com/nyaruka/goflow/flows/events" + "github.com/nyaruka/goflow/utils" "github.com/nyaruka/mailroom/runtime" "github.com/nyaruka/null/v3" ) @@ -86,6 +87,12 @@ func newRun(ctx context.Context, tx *sqlx.Tx, oa *OrgAssets, session *Session, f pathTimes[i] = p.ArrivedOn() } + // build results dict keyed by snakified name + results := make(map[string]*flows.Result, len(fr.Results())) + for resultName, result := range fr.Results() { + results[utils.Snakify(resultName)] = result + } + flowID, err := FlowIDForUUID(ctx, tx, oa, fr.FlowReference().UUID) if err != nil { return nil, fmt.Errorf("unable to load flow with uuid: %s: %w", fr.FlowReference().UUID, err) @@ -105,7 +112,7 @@ func newRun(ctx context.Context, tx *sqlx.Tx, oa *OrgAssets, session *Session, f Path: string(jsonx.MustMarshal(path)), PathNodes: pathNodes, PathTimes: pq.GenericArray{A: pathTimes}, - Results: string(jsonx.MustMarshal(fr.Results())), + Results: string(jsonx.MustMarshal(results)), run: fr, } diff --git a/go.mod b/go.mod index 38b8fd634..48d251483 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/lib/pq v1.10.9 github.com/nyaruka/ezconf v0.3.0 github.com/nyaruka/gocommon v1.59.3 - github.com/nyaruka/goflow v0.225.3 + github.com/nyaruka/goflow v0.225.4 github.com/nyaruka/null/v3 v3.0.0 github.com/nyaruka/redisx v0.8.1 github.com/nyaruka/rp-indexer/v9 v9.2.1 diff --git a/go.sum b/go.sum index fcf405e18..b64181381 100644 --- a/go.sum +++ b/go.sum @@ -224,8 +224,8 @@ github.com/nyaruka/ezconf v0.3.0 h1:kGvJqVN8AHowb4HdaHAviJ0Z3yI5Pyekp1WqibFEaGk= github.com/nyaruka/ezconf v0.3.0/go.mod h1:89GUW6EPRNLIxT7lC4LWnjWTgZeQwRoX7lBmc8ralAU= github.com/nyaruka/gocommon v1.59.3 h1:fdjs9Z7aH+zog7FXlEpvJ0GtI6XNdNdBtjFxw5kVB7s= github.com/nyaruka/gocommon v1.59.3/go.mod h1:peOpluiVBMeQu81Ar+7EPQVT7vawN6ho9Kh1k/Gj8Vk= -github.com/nyaruka/goflow v0.225.3 h1:NUK6o8sBIUSz7fvc0Mz/jqpIJLcKwwvUtldUY11OlcU= -github.com/nyaruka/goflow v0.225.3/go.mod h1:1Up4YMccDCugTrVcXEbNCxDJqZRJindQR75oiMBCZvY= +github.com/nyaruka/goflow v0.225.4 h1:3Ckau7wEVEndal5Boc8/HLAYjhcxCh+N4HWuSzT+JiQ= +github.com/nyaruka/goflow v0.225.4/go.mod h1:1Up4YMccDCugTrVcXEbNCxDJqZRJindQR75oiMBCZvY= github.com/nyaruka/librato v1.1.1 h1:0nTYtJLl3Sn7lX3CuHsLf+nXy1k/tGV0OjVxLy3Et4s= github.com/nyaruka/librato v1.1.1/go.mod h1:fme1Fu1PT2qvkaBZyw8WW+SrnFe2qeeCWpvqmAaKAKE= github.com/nyaruka/null/v2 v2.0.3 h1:rdmMRQyVzrOF3Jff/gpU/7BDR9mQX0lcLl4yImsA3kw=