summaryrefslogtreecommitdiff
path: root/ausbutler/interface.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-05-04 15:39:23 +0200
committeremkael <emkael@tlen.pl>2017-05-09 02:50:59 +0200
commit023723a3f1fd6e0962f47e488b234ef9d0ca25b3 (patch)
tree7ed831ee69cd511497caaa565aed5e572cb257ac /ausbutler/interface.py
parent6edc2b27e67b5872afb8fff0a5ae100e10ca6c5c (diff)
Calculating normalized butler only for finished segments
Diffstat (limited to 'ausbutler/interface.py')
-rw-r--r--ausbutler/interface.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/ausbutler/interface.py b/ausbutler/interface.py
index c239705..4f55850 100644
--- a/ausbutler/interface.py
+++ b/ausbutler/interface.py
@@ -68,18 +68,22 @@ class Interface(object):
column_match = re.match(column_name, column)
if column_match:
if value is not None:
- aus_b = AusButler()
- aus_b.id = butler.id
- aus_b.match = int(column_match.group(1), base=10)
- aus_b.segment = int(column_match.group(2))
- aus_b.score = float(value)
- aus_b.cut_score = cutoff(
- aus_b.score,
- self.config['cutoff_point'],
- self.config['cutoff_rate'])
- aus_b.board_count = aus_b.table.butler_count[
- get_room(aus_b, butler.id)]
- self.session.add(aus_b)
+ round_no = int(column_match.group(1), base=10)
+ segm_no = int(column_match.group(2))
+ if round_no < Constants.rnd or (
+ round_no == Constants.rnd and segm_no <= Constants.segm):
+ aus_b = AusButler()
+ aus_b.id = butler.id
+ aus_b.match = round_no
+ aus_b.segment = segm_no
+ aus_b.score = float(value)
+ aus_b.cut_score = cutoff(
+ aus_b.score,
+ self.config['cutoff_point'],
+ self.config['cutoff_rate'])
+ aus_b.board_count = aus_b.table.butler_count[
+ get_room(aus_b, butler.id)]
+ self.session.add(aus_b)
self.session.commit()
def __filter_opp_score(self, butler, opp_butler):