def existing_conversion(self, client): alts = self.get_alternative_names() keys = [_key("c:{0}:{1}:users:all".format(self.kpi_key(), alt)) for alt in alts] altkey = first_key_with_bit_set(keys=keys, args=[self.sequential_id(client)]) if altkey: idx = keys.index(altkey) return Alternative(alts[idx], self, redis=self.redis) return None
def existing_alternative(self, client): if self.is_client_excluded(client): return self.control alts = self.get_alternative_names() keys = [_key("p:{0}:{1}:all".format(self.name, alt)) for alt in alts] altkey = first_key_with_bit_set(keys=keys, args=[self.sequential_id(client)]) if altkey: idx = keys.index(altkey) return Alternative(alts[idx], self, redis=self.redis) return None
def existing_alternative(self, client): if self.is_client_excluded(client): return None alts = self.get_alternative_names() # print("existing_alternative alts:",alts) keys = [_key("p:{0}:{1}:all".format(self.name, alt)) for alt in alts] # print("existing_alternative keys:",keys) # print("existing_alternative self.sequential_id(client):",self.sequential_id(client)) altkey = first_key_with_bit_set(keys=keys, args=[self.sequential_id(client)]) # print("excluded_clients altkey:",altkey) if altkey: idx = keys.index(altkey) # print("existing_alternative keys.index:",idx) return Alternative(alts[idx], self, redis=self.redis) return None