]> de.git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/batch/badges/gen_badges.py
Simplify the player create/update function.
[xonotic/xonstat.git] / xonstat / batch / badges / gen_badges.py
index d0d6fb226e5c0b46bb629a2eaf84ac8fc401c9c1..5875f8f01408df93138815228c07702c10d6986b 100644 (file)
@@ -1,17 +1,14 @@
 #-*- coding: utf-8 -*-
 
 import sys
-from datetime import datetime
-import sqlalchemy as sa
-import sqlalchemy.sql.functions as func
-from sqlalchemy import distinct
-from pyramid.paster import bootstrap
-from xonstat.models import *
-from xonstat.util import datetime_seconds
+from datetime import datetime, timedelta
 
-from skin import Skin
 from playerdata import PlayerData
-
+from pyramid.paster import bootstrap
+from skin import Skin
+from sqlalchemy import distinct
+from xonstat.models import DBSession, PlayerGameStat, Player, PlayerElo
+from xonstat.util import datetime_seconds
 
 # maximal number of query results (for testing, set to None to get all)
 NUM_PLAYERS = None
@@ -20,7 +17,7 @@ NUM_PLAYERS = None
 PLAYER_ID = None
 
 # we look for players who have activity within the past DELTA hours
-DELTA = 6
+DELTA = 50000
 
 VERBOSE = False
 
@@ -37,18 +34,18 @@ skin_archer = Skin( "archer",
         #bg              = "background_archer-v2_full",
         bg              = "background_archer-v3",
         overlay         = "",
-        nick_maxwidth  = 260,
-        gametype_pos    = (91,33),
-        nostats_pos            = (91,59),
-        elo_pos        = (91,47),
-        rank_pos    = (91,58),
-        winp_pos       = (509,20),
-        wins_pos       = (508,35),
-        loss_pos       = (508,45),
-        kdr_pos                = (392,20),
-        kills_pos      = (392,35),
-        deaths_pos     = (392,45),
-        ptime_color    = (0.05, 0.05, 0.1),
+        nick_maxwidth   = 260,
+        gametype_pos    = (95,33),
+        nostats_pos     = (95,59),
+        elo_pos         = (95,47),
+        rank_pos        = (95,58),
+        winp_pos        = (509,19),
+        wins_pos        = (508,34),
+        loss_pos        = (508,45),
+        kdr_pos         = (392,19),
+        kills_pos       = (392,34),
+        deaths_pos      = (392,45),
+        ptime_color     = (0.05, 0.05, 0.1),
     )
 
 # minimal skin - writes PNGs into "output/minimal/###.png"
@@ -59,7 +56,7 @@ skin_minimal = Skin( "minimal",
         width           = 560,
         height          = 40,
         nick_fontsize   = 16,
-        nick_pos        = (36,16),
+        nick_pos        = (36,17),
         num_gametypes   = 3,
         nick_maxwidth   = 280,
         gametype_pos    = (70,30),
@@ -81,14 +78,14 @@ skin_minimal = Skin( "minimal",
         #nostats_text    = "no stats yet!",
         #nostats_color   = (0.7, 0.4, 0.4),
         kdr_pos         = (392,15),
-        kdr_fontsize    = 10,
+        kdr_fontsize    = 11,
         kdr_colortop    = (0.6, 0.8, 0.6),
         kdr_colormid    = (0.6, 0.6, 0.6),
         kdr_colorbot    = (0.8, 0.6, 0.6),
         kills_pos       = None,
         deaths_pos      = None,
-        winp_pos        = (508,15),
-        winp_fontsize   = 10,
+        winp_pos        = (509,15),
+        winp_fontsize   = 11,
         winp_colortop   = (0.6, 0.8, 0.8),
         winp_colormid   = (0.6, 0.6, 0.6),
         winp_colorbot   = (0.8, 0.8, 0.6),