flagsmith icon indicating copy to clipboard operation
flagsmith copied to clipboard

1145 add is set and is not set segment operators

Open EdsnLoor opened this issue 2 years ago • 4 comments

Logic created for IS_SET & IS_NOT_SET options

EdsnLoor avatar Sep 20 '22 14:09 EdsnLoor

Note: would need docs update https://github.com/Flagsmith/flagsmith-docs/blob/main/docs/deployment/overview.md#segment_operators and operator syntax to allow for empty values

kyle-ssg avatar Sep 21 '22 10:09 kyle-ssg

Note: would need docs update https://github.com/Flagsmith/flagsmith-docs/blob/main/docs/deployment/overview.md#segment_operators and operator syntax to allow for empty values

@EdsnLoor can you add a PR for this in the docs thanks! https://github.com/Flagsmith/flagsmith-docs

dabeeeenster avatar Sep 21 '22 12:09 dabeeeenster

@kyle-ssg @dabeeeenster I'm not sure if we need to update the docs for this one, do we? The docs state:

All of the operators act as you would expect. Some of the operators also have special powers!

I would argue that 'Is set' and 'Is not set' are pretty self explanatory?

matthewelwell avatar Sep 21 '22 16:09 matthewelwell

@kyle-ssg @dabeeeenster I'm not sure if we need to update the docs for this one, do we? The docs state:

All of the operators act as you would expect. Some of the operators also have special powers!

I would argue that 'Is set' and 'Is not set' are pretty self explanatory?

I feel like "Trait exists" and "Trait does not exist" might be better?

dabeeeenster avatar Sep 21 '22 17:09 dabeeeenster

@kyle-ssg @dabeeeenster I'm not sure if we need to update the docs for this one, do we? The docs state:

All of the operators act as you would expect. Some of the operators also have special powers!

I would argue that 'Is set' and 'Is not set' are pretty self explanatory?

There's a section in the docs where we list remote config values of segment operators. https://docs.flagsmith.com/deployment/overview#segment_operators. I guess we'll be merging this PR quite a bit before we adjust it though.

kyle-ssg avatar Oct 05 '22 14:10 kyle-ssg

@matthewelwell @EdsnLoor I think this needs some tests around segments creation without value, this breaks if I don't pass value.

curl --location --request POST 'http://localhost:8000/api/v1/projects/1/segments/'
--header 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0'
--header 'Accept: application/json'
--header 'Accept-Language: en-US,en;q=0.5'
--header 'Accept-Encoding: gzip, deflate, br'
--header 'Referer: https://app.flagsmith.com/'
--header 'Content-Type: application/json; charset=utf-8'
--header 'AUTHORIZATION: Token '
--header 'Origin: https://app.flagsmith.com'
--header 'DNT: 1'
--header 'Connection: keep-alive'
--header 'Sec-Fetch-Dest: empty'
--header 'Sec-Fetch-Mode: cors'
--header 'Sec-Fetch-Site: same-site'
--header 'TE: trailers'
--data-raw '{"description":"","name":"is_not_set","rules":[{"type":"ALL","rules":[{"type":"ANY","conditions":[{"property":"prop","operator":"IS_NOT_SET"}]}]}],"project":1}'

gagantrivedi avatar Oct 06 '22 07:10 gagantrivedi