From e4ae2bba518957500b76538181d1b22a8fcfa7b3 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Tue, 19 Dec 2017 14:44:37 -0500 Subject: [PATCH] Wire up the Glicko tables in the ORM. --- xonstat/models/__init__.py | 4 ++++ xonstat/models/player.py | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/xonstat/models/__init__.py b/xonstat/models/__init__.py index 39bc8ed..817cc37 100644 --- a/xonstat/models/__init__.py +++ b/xonstat/models/__init__.py @@ -59,6 +59,8 @@ def initialize_db(engine=None): active_maps_table = metadata.tables['active_maps_mv'] player_medals_table = metadata.tables['player_medals'] player_game_frag_matrix_table = metadata.tables['player_game_frag_matrix'] + player_glickos_base_table = metadata.tables['player_glickos_base'] + player_glickos_current_table = metadata.tables['player_glickos_current'] # Map the tables and the objects together mapper(PlayerAchievement, achievements_table) @@ -85,3 +87,5 @@ def initialize_db(engine=None): mapper(ActiveMap, active_maps_table) mapper(PlayerMedal, player_medals_table) mapper(PlayerGameFragMatrix, player_game_frag_matrix_table) + mapper(PlayerGlicko, player_glickos_current_table) + mapper(PlayerGlickoBase, player_glickos_base_table) diff --git a/xonstat/models/player.py b/xonstat/models/player.py index 655aa5c..fece334 100644 --- a/xonstat/models/player.py +++ b/xonstat/models/player.py @@ -255,4 +255,12 @@ class PlayerGlicko(object): mu=self.mu * GLICKO2_SCALE + MU, phi=self.phi * GLICKO2_SCALE, sigma=self.sigma - ) \ No newline at end of file + ) + + +class PlayerGlickoBase(PlayerGlicko): + """ + A clone of the above PlayerGlicko class, but created separately in order to avoid + dealing with primary and non-primary SQLAlchemy mappers. + """ + pass \ No newline at end of file -- 2.39.2