diff options
-rw-r--r-- | ausbutler/interface.py | 12 | ||||
-rw-r--r-- | config/butler.json | 1 |
2 files changed, 10 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( diff --git a/config/butler.json b/config/butler.json index e238779..89d97a3 100644 --- a/config/butler.json +++ b/config/butler.json @@ -2,5 +2,6 @@ "cutoff_point": 32, "cutoff_rate": 0.1, "opponent_factor": 0.5, + "only_current": 0, "segments_in_table_limit": 10 } |