diff options
author | emkael <emkael@tlen.pl> | 2017-01-10 12:30:40 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-01-10 12:30:40 +0100 |
commit | d0ba0cbae2726abc32b638a12d3b176c939c6857 (patch) | |
tree | 8a34571af9c22943b8b76742ff30959199cae417 /ausbutler | |
parent | abd09ddce26dfc8dee8b352e86c50185d548e61a (diff) |
Option to calculate opponents' scores with all results, not only current
Diffstat (limited to 'ausbutler')
-rw-r--r-- | ausbutler/interface.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ausbutler/interface.py b/ausbutler/interface.py index 59a44c2..8207cfe 100644 --- a/ausbutler/interface.py +++ b/ausbutler/interface.py @@ -54,6 +54,14 @@ class Interface(object): self.session.add(aus_b) self.session.commit() + def __filter_opp_score(self, butler, opp_butler): + if self.config['only_current']: + return opp_butler.match < butler.match or \ + (opp_butler.match == butler.match and \ + opp_butler.segment <= butler.segment) + else: + return True + def opp_scores(self): butlers = self.session.query(AusButler).all() for butler in butlers: @@ -62,9 +70,7 @@ class Interface(object): opps[1]: {'sum': 0.0, 'count': 0}} for opp_butler in butlers: if opp_butler.id in opps \ - and (opp_butler.match < butler.match or - (opp_butler.match == butler.match and - opp_butler.segment <= butler.segment)): + and self.__filter_opp_score(butler, opp_butler): averages[opp_butler.id]['sum'] += opp_butler.cut_score averages[opp_butler.id]['count'] += opp_butler.board_count butler.opp_score = sum( |