lib/rollout.rb in rollout-0.2.0 vs lib/rollout.rb in rollout-0.2.1
- old
+ new
@@ -60,19 +60,18 @@
def percentage_key(name)
"#{key(name)}:percentage"
end
def user_in_active_group?(feature, user)
- @redis.smembers(group_key(feature)).any? { |group| @groups[group].call(user) }
+ @redis.smembers(group_key(feature)).any? { |group| @groups.key?(group) && @groups[group].call(user) }
end
def user_active?(feature, user)
@redis.sismember(user_key(feature), user.id)
end
def user_within_active_percentage?(feature, user)
percentage = @redis.get(percentage_key(feature))
return false if percentage.nil?
-
- user.id % 10 < percentage.to_i / 10
+ user.id % 100 < percentage.to_i
end
end