<commit_before>import dbmanager
import weconnect, fitbit

STEP_GOAL = 1000000

def setup():
	pt_users = dbmanager.get_users()
	for user in pt_users:
		fb = fitbit.Fitbit(user["fb_token"], user["goal_period"])
		fb.change_step_goal(STEP_GOAL)

def loop():
	"""
	This code will run forever.
	"""
	while True:
		pt_users = dbmanager.get_users()
		print(pt_users)
		for user in pt_users:
			pollAndUpdate(user)

def pollAndUpdate(user):
	# Sets up the objects that will perform the WEconnect and Fitbit API
	# calls
	print(user.keys())
	user_id = user["id"]
	wc = weconnect.WeConnect(user["wc_id"], user["wc_token"], user["goal_period"])
	fb = fitbit.Fitbit(user["fb_token"], user["goal_period"])

	# Polls WEconnect for changes and then updates Fitbit. Progress will be a 
	# decimal percentage.
	progress = wc.poll()
	print(progress)

	# Makes sure the poll request succeeded
	if progress != -1:
		step_count = fb.reset_and_update(progress)
		dbmanager.add_log(user_id, progress, step_count)

# Runs code
setup()
loop()<commit_msg>Fixed name error<commit_after>import dbmanager
import weconnect, fitbit

STEP_GOAL = 1000000

def setup():
	pt_users = dbmanager.get_users()
	for user in pt_users:
		fb = fitbit.Fitbit(user["fb_token"], user["goal_period"])
		fb.change_step_goal(STEP_GOAL)

def loop():
	"""
	This code will run forever.
	"""
	while True:
		pt_users = dbmanager.get_users()
		print(pt_users)
		for user in pt_users:
			pollAndUpdate(user)

def pollAndUpdate(user):
	# Sets up the objects that will perform the WEconnect and Fitbit API
	# calls
	print(user.keys())
	user_id = user["id"]
	wc = weconnect.WeConnect(user["wc_id"], user["wc_token"], user["goal_period"])
	fb = fitbit.Fitbit(user["fb_token"], user["goal_period"])

	# Polls WEconnect for changes and then updates Fitbit. Progress will be a 
	# decimal percentage.
	progress = wc.poll()
	print(progress)

	# Makes sure the poll request succeeded
	if progress != -1:
		step_count = fb.reset_and_update(progress)
		dbmanager.insert_log(user_id, progress, step_count)

# Runs code
setup()
loop()
{'fraction_non_alphanumeric': 0.12015503875968993, 'fraction_numerical': 0.007751937984496124, 'mean_word_length': 5.020408163265306, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2320917', 'n_tokens_mistral': 773, 'n_tokens_neox': 714, 'n_words': 193}