File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
flagsmith-engine/features Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -96,18 +96,27 @@ export class FeatureStateModel {
9696 }
9797 return this . featureSegment . priority < other . featureSegment . priority ;
9898 }
99-
100- getMultivariateValue ( identityID : number | string ) {
101- const percentageValue = getHashedPercentateForObjIds ( [
102- this . djangoID || this . featurestateUUID ,
103- identityID
104- ] ) ;
10599
100+ getMultivariateValue ( identityID : number | string ) {
101+ let percentageValue : number | undefined ;
106102 let startPercentage = 0 ;
107- const sortedF = this . multivariateFeatureStateValues . sort ( ( a , b ) => {
103+ const sortedF = this . multivariateFeatureStateValues . sort ( ( a , b ) => {
108104 return a . id - b . id ;
109105 } ) ;
110106 for ( const myValue of sortedF ) {
107+ switch ( myValue . percentageAllocation ) {
108+ case 0 :
109+ continue ;
110+ case 100 :
111+ return myValue . multivariateFeatureOption . value ;
112+ default :
113+ if ( percentageValue === undefined ) {
114+ percentageValue = getHashedPercentateForObjIds ( [
115+ this . djangoID || this . featurestateUUID ,
116+ identityID
117+ ] ) ;
118+ }
119+ }
111120 const limit = myValue . percentageAllocation + startPercentage ;
112121 if ( startPercentage <= percentageValue && percentageValue < limit ) {
113122 return myValue . multivariateFeatureOption . value ;
You can’t perform that action at this time.
0 commit comments