import jingrow

jingrow.reload_pagetype("Team")
jingrow.reload_pagetype("Site")


def execute():
	"""Sets the value of notify email as team name"""
	teams = jingrow.get_all("Team", pluck="name")
	for team in teams:
		jingrow.db.set_value("Team", team, "notify_email", team)

	sites = jingrow.get_all("Site", fields=["name", "team"])
	for site in sites:
		jingrow.db.set_value("Site", site.name, "notify_email", site.team)
