def create_task(params):

	"""
	Create a task.

	Arguments:
		task_title (string): Title of task.

	Side-effects: Emits 'task_created' event with task object payload.
	"""

	if 'task_title' not in params:
		return None
	task_title = params['task_title']
	task = TaskService.create_task(task_title)
	if task is not None:
		task = TaskService.get_task_api_formatted_data(task)
		emit('task_created', task, broadcast=True)
from utils.print import ppp


# mock data
user_names = ['jim', 'bob', 'sara', 'penny']
task_titles = ['do the dishes', 'buy a car', 'build an app']


# populate mock users
users = []
for user_name in user_names:
	users.append(UserService.create_user(user_name))

# populate mock tasks
tasks = []
for title in task_titles:
	tasks.append(TaskService.create_task(title))

# load vote variants for reference
vote_variants = VoteVariantService.load_all_vote_variants()

# populate mock votes
for user in users:
	for task in tasks:
		VoteService.create_vote(
			user.uuid4, 
			task.uuid4, 
			random.choice(vote_variants).variant
		)