Mercurial > kallithea
changeset 5040:930caa6a4e5f
changeset status: simplify status calculation logic
author | Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> |
---|---|
date | Fri, 17 Apr 2015 14:58:44 +0200 |
parents | 36d81185efe4 |
children | 6b1e1437c026 |
files | kallithea/model/changeset_status.py |
diffstat | 1 files changed, 5 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/model/changeset_status.py Fri Apr 17 14:49:37 2015 +0200 +++ b/kallithea/model/changeset_status.py Fri Apr 17 14:58:44 2015 +0200 @@ -72,16 +72,13 @@ the policy: approve if consensus. """ - approved_votes = 0 - for st in statuses: - if st and st.status == ChangesetStatus.STATUS_APPROVED: - approved_votes += 1 + if not statuses: + return ChangesetStatus.STATUS_UNDER_REVIEW - result = ChangesetStatus.STATUS_UNDER_REVIEW - if approved_votes and approved_votes == len(statuses): - result = ChangesetStatus.STATUS_APPROVED + if all(st.status == ChangesetStatus.STATUS_APPROVED for st in statuses): + return ChangesetStatus.STATUS_APPROVED - return result + return ChangesetStatus.STATUS_UNDER_REVIEW def calculate_pull_request_result(self, pull_request): """