def simulate_active_visits(users_tokens, business_id, visit_time, isRatingVisit=False): map(lambda user_token: hm.send_checkin(user_token, business_id), users_tokens) if isRatingVisit: map(lambda user_token: hm.send_rating(user_token, business_id, 5), users_tokens) else: map(lambda user_token: hm.send_rating(user_token, business_id, random.randint(1, 5)), users_tokens) time.sleep(visit_time) map(lambda user_token: hm.send_checkout(user_token, business_id), users_tokens)
def simulate_visit((user_token, business_id)): hm.send_checkin(user_token, business_id) for _ in xrange(1, random.randint(0, 5)): hm.send_qrscan(user_token, business_id, 'sample_payload') hm.send_rating(user_token, business_id, random.randint(1, 5)) hm.send_checkout(user_token, business_id, timestamp_offset=random.randint(0, 3600))