<commit_before>import webnotes

def execute():
	"""
		* Reload email_digest doctype
		* Create default email digest
	"""
	from webnotes.modules.module_manager import reload_doc
	
	# Minor fix in print_format doctype
	#reload_doc('core', 'doctype', 'print_format')
	
	reload_doc('setup', 'doctype', 'email_digest')

	global create_default_email_digest
	create_default_email_digest()


def create_default_email_digest():
	"""
		* Weekly Digest
		* For all companies
		* Recipients: System Managers
		* Full content
		* Disabled by default
	"""
	from webnotes.model.doc import Document
	companies_list = webnotes.conn.sql("SELECT company_name FROM `tabCompany`", as_list=1)
	global get_system_managers
	system_managers = get_system_managers()
	for company in companies_list:
		if company and company[0]:
			edigest = Document('Email Digest')
			edigest.name = "Default Weekly Digest - " + company[0]<commit_msg>Modified deploy_email_digest to enable all the default email digests<commit_after>import webnotes

def execute():
	"""
		* Reload email_digest doctype
		* Create default email digest
	"""
	from webnotes.modules.module_manager import reload_doc
	
	# Minor fix in print_format doctype
	#reload_doc('core', 'doctype', 'print_format')
	
	#reload_doc('setup', 'doctype', 'email_digest')

	#global create_default_email_digest
	#create_default_email_digest()

	global enabled_default_email_digest
	enabled_default_email_digest()


def enabled_default_email_digest():
	"""
		Enables the created email digest
	"""
	from webnotes.model.doc import Document
	companies_list = webnotes.conn.sql("SELECT company_name FROM `tabCompany`", as_list=1)
	for company in companies_list:
		if company and company[0]:
			edigest = Document('Email Digest', 'Default Weekly Digest - ' + company[0])
			if edigest:
				edigest.enabled = 1
				edigest.save()


def create_default_email_digest():
	"""
		* Weekly Digest
		* For all companies
		* Recipients: System Managers
		* Full content
		* Disabled by default
	"""
	from webnotes.model.doc import Document
	companies_list = webnotes.conn.sql("SELECT company_name FROM `tabCompany`", as_list=1)
	global get_system_managers
	system_managers = get_system_managers()
	for company in companies_list:
		if company and company[0]:
			edigest = Document('Email Digest')
			edigest.name = "Default Weekly Digest - " + company[0]
{'fraction_non_alphanumeric': 0.0955819881053526, 'fraction_numerical': 0.004248088360237893, 'mean_word_length': 5.164921465968586, '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': '5885205', 'n_tokens_mistral': 821, 'n_tokens_neox': 737, 'n_words': 195}