mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[FIX] runbot: avoid traceback when build_ids was empty (eg: filter by search) or not declared.
equivalent to max(build_ids, default=0) in python 3
This commit is contained in:
parent
fccd90f755
commit
5ef0b2ee6d
@ -1195,6 +1195,7 @@ class RunbotController(http.Controller):
|
|||||||
'refresh': refresh,
|
'refresh': refresh,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
build_ids = []
|
||||||
if repo:
|
if repo:
|
||||||
filters = {key: post.get(key, '1') for key in ['pending', 'testing', 'running', 'done']}
|
filters = {key: post.get(key, '1') for key in ['pending', 'testing', 'running', 'done']}
|
||||||
domain = [('repo_id','=',repo.id)]
|
domain = [('repo_id','=',repo.id)]
|
||||||
@ -1263,7 +1264,7 @@ class RunbotController(http.Controller):
|
|||||||
})
|
})
|
||||||
|
|
||||||
# consider host gone if no build in last 100
|
# consider host gone if no build in last 100
|
||||||
build_threshold = max(build_ids) - 100
|
build_threshold = max(build_ids or [0]) - 100
|
||||||
|
|
||||||
for result in build_obj.read_group(cr, uid, [('id', '>', build_threshold)], ['host'], ['host']):
|
for result in build_obj.read_group(cr, uid, [('id', '>', build_threshold)], ['host'], ['host']):
|
||||||
if result['host']:
|
if result['host']:
|
||||||
|
Loading…
Reference in New Issue
Block a user