# -*- coding: utf-8 -*-
# Copyright (c) 2021, JINGROW
# For license information, please see license.txt


import jingrow


def execute():
	apps = jingrow.db.sql(
		"""
		SELECT
			candidate.name, app.title
		FROM
			`tabDeploy Candidate App` candidate
		LEFT JOIN
			`tabApp` app
		ON
			candidate.app = app.name
	""",
		as_dict=True,
	)

	for app in apps:
		jingrow.db.set_value("Deploy Candidate App", app.name, "title", app.title)
