[FIX] runbot: avoid error when there is no build

This commit is contained in:
Xavier-Do 2022-07-07 11:10:42 +02:00
parent e1161a03e6
commit a672088acf

View File

@ -495,6 +495,8 @@ class Runbot(Controller):
limit -= len(builds)
builds |= builds.search(builds_domain, order='id desc', limit=limit)
if not builds:
return {}
builds = builds.search([('id', 'child_of', builds.ids)])
@ -502,7 +504,8 @@ class Runbot(Controller):
request.env.cr.execute("SELECT build_id, values FROM runbot_build_stat WHERE build_id IN %s AND category = %s", [tuple(builds.ids), key_category]) # read manually is way faster than using orm
res = {}
for (build_id, values) in request.env.cr.fetchall():
res.setdefault(parents[build_id], {}).update(values)
if values:
res.setdefault(parents[build_id], {}).update(values)
# we need to update here to manage the post install case: we want to combine stats from all post_install childrens.
return res