From 023723a3f1fd6e0962f47e488b234ef9d0ca25b3 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 4 May 2017 15:39:23 +0200 Subject: Calculating normalized butler only for finished segments --- ausbutler/interface.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'ausbutler/interface.py') 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): -- cgit v1.2.3