Skip to content

Commit

Permalink
Merge pull request rapidpro#246 from nyaruka/latest_goflow
Browse files Browse the repository at this point in the history
Update to latest goflow which normalizes search props with type prefixes
  • Loading branch information
rowanseymour authored May 15, 2024
2 parents 2900ec5 + 9d4094d commit f73fe2e
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions core/search/queries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ func TestBuildRecipientsQuery(t *testing.T) {
expected: `uuid = "6393abc0-283d-4c9b-a1b3-641a035c34bf" AND status = "active"`,
},
{ // 3
userQuery: `fields.gender = "M"`,
userQuery: `fields.GENDER = "M"`,
exclusions: models.Exclusions{},
expected: `gender = "M"`,
expected: `fields.gender = "M"`,
},
{ // 4
userQuery: `gender = "M"`,
Expand All @@ -74,7 +74,7 @@ func TestBuildRecipientsQuery(t *testing.T) {
StartedPreviously: true,
NotSeenSinceDays: 30,
},
expected: `gender = "M" AND status = "active" AND flow = "" AND history != "Favorites" AND last_seen_on > "21-03-2022"`,
expected: `fields.gender = "M" AND status = "active" AND flow = "" AND history != "Favorites" AND last_seen_on > "21-03-2022"`,
},
{ // 5
userQuery: `name ~ ben`,
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22

require (
github.com/Masterminds/semver v1.5.0
github.com/aws/aws-sdk-go v1.52.5
github.com/aws/aws-sdk-go v1.53.3
github.com/buger/jsonparser v1.1.1
github.com/edganiukov/fcm v0.4.0
github.com/getsentry/sentry-go v0.27.0
Expand All @@ -18,7 +18,7 @@ require (
github.com/lib/pq v1.10.9
github.com/nyaruka/ezconf v0.3.0
github.com/nyaruka/gocommon v1.54.9
github.com/nyaruka/goflow v0.212.0
github.com/nyaruka/goflow v0.213.0
github.com/nyaruka/null/v3 v3.0.0
github.com/nyaruka/redisx v0.8.0
github.com/nyaruka/rp-indexer/v9 v9.1.0
Expand All @@ -36,7 +36,7 @@ require (

require (
github.com/Shopify/gomail v0.0.0-20220729171026-0784ece65e69 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
github.com/blevesearch/segment v0.9.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/structs v1.1.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3Q
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Shopify/gomail v0.0.0-20220729171026-0784ece65e69 h1:gPoXdwo3sKq8qcfMu/Nc/wkJMLKwe7kaG9Uo8tOj3cU=
github.com/Shopify/gomail v0.0.0-20220729171026-0784ece65e69/go.mod h1:RS+Gaowa0M+gCuiFAiRMGBCMqxLrNA7TESTU/Wbblm8=
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g=
github.com/aws/aws-sdk-go v1.52.5 h1:m2lty5v9sHm1J3lhA43hJql+yKZudF09qzab0Ag9chM=
github.com/aws/aws-sdk-go v1.52.5/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=
github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw=
github.com/aws/aws-sdk-go v1.53.3 h1:xv0iGCCLdf6ZtlLPMCBjm+tU9UBLP5hXnSqnbKFYmto=
github.com/aws/aws-sdk-go v1.53.3/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/blevesearch/segment v0.9.1 h1:+dThDy+Lvgj5JMxhmOVlgFfkUtZV2kw49xax4+jTfSU=
github.com/blevesearch/segment v0.9.1/go.mod h1:zN21iLm7+GnBHWTao9I+Au/7MBiL8pPFtJBJTsk6kQw=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
Expand Down Expand Up @@ -84,8 +84,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.54.9 h1:BvWgXQc7h9Qlhj347N56wPZiik64SGmv+qSLmar4pVo=
github.com/nyaruka/gocommon v1.54.9/go.mod h1:rWkEIpYIK98zL9Qm6PeMXJ+84WcWlArf01RfuWWCYvQ=
github.com/nyaruka/goflow v0.212.0 h1:Pw1CNRSyE2v8K34MTjlQAxjzh8ik0uJYnFji4bZICXg=
github.com/nyaruka/goflow v0.212.0/go.mod h1:woIrnzel6HaHSUnihVeDau52l7mDEAy8aHAsxf9ZWfU=
github.com/nyaruka/goflow v0.213.0 h1:DLOrrHk6KOgnBwyEtkBNR8tonjoyG57iOB5bxLN43LE=
github.com/nyaruka/goflow v0.213.0/go.mod h1:woIrnzel6HaHSUnihVeDau52l7mDEAy8aHAsxf9ZWfU=
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
2 changes: 1 addition & 1 deletion web/contact/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func TestSearch(t *testing.T) {
body: fmt.Sprintf(`{"org_id": 1, "query": "AGE = 10 and gender = M", "group_id": %d}`, testdata.ActiveGroup.ID),
expectedStatus: 200,
expectedHits: []models.ContactID{},
expectedQuery: `age = 10 AND gender = "M"`,
expectedQuery: `fields.age = 10 AND fields.gender = "M"`,
expectedAttributes: []string{},
expectedFields: []*assets.FieldReference{
assets.NewFieldReference("age", "Age"),
Expand Down
4 changes: 2 additions & 2 deletions web/contact/testdata/parse_query.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
"status": 200,
"response": {
"query": "birthday = \"tomorrow\" AND tel = 12345",
"query": "fields.birthday = \"tomorrow\" AND urns.tel = 12345",
"metadata": {
"attributes": [],
"schemes": [
Expand All @@ -81,7 +81,7 @@
},
"status": 200,
"response": {
"query": "age > 10",
"query": "fields.age > 10",
"metadata": {
"attributes": [],
"schemes": [],
Expand Down
4 changes: 2 additions & 2 deletions web/flow/testdata/start_preview.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
},
"status": 200,
"response": {
"query": "gender = \"M\"",
"query": "fields.gender = \"M\"",
"total": 0
}
},
Expand Down Expand Up @@ -127,7 +127,7 @@
},
"status": 200,
"response": {
"query": "gender = \"M\" AND status = \"active\" AND flow = \"\" AND history != \"Pick a Number\" AND last_seen_on > \"07-04-2018\"",
"query": "fields.gender = \"M\" AND status = \"active\" AND flow = \"\" AND history != \"Pick a Number\" AND last_seen_on > \"07-04-2018\"",
"total": 0
}
},
Expand Down
4 changes: 2 additions & 2 deletions web/msg/testdata/broadcast_preview.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
},
"status": 200,
"response": {
"query": "gender = \"M\"",
"query": "fields.gender = \"M\"",
"total": 0
}
},
Expand Down Expand Up @@ -124,7 +124,7 @@
},
"status": 200,
"response": {
"query": "gender = \"M\" AND status = \"active\" AND flow = \"\" AND last_seen_on > \"07-04-2018\"",
"query": "fields.gender = \"M\" AND status = \"active\" AND flow = \"\" AND last_seen_on > \"07-04-2018\"",
"total": 0
}
},
Expand Down

0 comments on commit f73fe2e

Please sign in to comment.