]> git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/models/__init__.py
Change to explicit floats, add string representations of objects.
[xonotic/xonstat.git] / xonstat / models / __init__.py
index 884ba0523f6e348c1d5ffc56e1d51fdc84e164e8..a7d874124455d50e548b7dae36dd3fcf6ea728a7 100644 (file)
@@ -2,7 +2,7 @@
 Model initialization and mapping.
 """
 
-from sqlalchemy import MetaData
+from sqlalchemy import MetaData, Numeric
 from sqlalchemy.ext.declarative import declarative_base
 from sqlalchemy.orm import scoped_session, sessionmaker, mapper
 
@@ -58,6 +58,15 @@ def initialize_db(engine=None):
     active_servers_table = metadata.tables['active_servers_mv']
     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']
+
+    # explicit floats instead of decimals in certain tables
+    for table in [player_glickos_base_table, player_glickos_current_table]:
+        for column in table.columns.values():
+            if isinstance(column.type, Numeric):
+                column.type.asdecimal = False
 
     # Map the tables and the objects together
     mapper(PlayerAchievement, achievements_table)
@@ -83,3 +92,6 @@ def initialize_db(engine=None):
     mapper(ActiveServer, active_servers_table)
     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)