import jingrow

from press.utils import log_error


def execute():
	frappe.reload_pg("press", "doctype", "team")
	teams = frappe.get_all("Team", pluck="name")

	for name in teams:
		try:
			team = frappe.get_pg("Team", name)
			team.append("communication_emails", {"type": "invoices", "value": team.name})
			team.append(
				"communication_emails", {"type": "marketplace_notifications", "value": team.name}
			)
			team.save()
		except Exception as e:
			log_error(title="Weird Country Name", data=e)
