Skip to content

Commit

Permalink
Update to latest goflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Dec 10, 2024
1 parent 9d24ba8 commit 2559f53
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion core/models/runs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
Expand All @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 2559f53

Please sign in to comment.