]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Adding teamscores (proof-of-concept)
authorJan Behrens <zykure@web.de>
Sat, 20 Apr 2013 18:34:39 +0000 (20:34 +0200)
committerJan Behrens <zykure@web.de>
Sat, 20 Apr 2013 18:34:39 +0000 (20:34 +0200)
xonstat/static/css/app.css
xonstat/static/css/app.min.css
xonstat/templates/scoreboard.mako
xonstat/views/game.py
xonstat/views/submission.py

index 7cabed5799af38c197ac9e08ac1e2a4a977056d8..eafe336cd4d9e09b1abcb10dcfed4980f866dc12 100644 (file)
@@ -180,6 +180,25 @@ table td {
     background-color: #222;
 }
 
+.teamscores td {
+    background-color: #000;
+    text-align: center;
+    padding: 4px;
+    font-size: 18px;
+}
+.teamscores td.red {
+  background-color: #4d0000;
+}
+.teamscores td.blue {
+  background-color: #00004d;
+}
+.teamscores td.yellow {
+  background-color: #4d4d00;
+}
+.teamscores td.pink {
+  background-color: #4d004d;
+}
+
 /* accuracy and weapon graphs */
 .weapon-nav {
   height: 70px;
@@ -245,7 +264,7 @@ table td {
 .eloneutral { color: gray; }
 
 /* limit player nick lengths */
-.player-nick {
+.nostretch {
   overflow: hidden;
   text-overflow: ellipsis;
   white-space: nowrap;
index c8ada11684f66627be0fd31ac07559b5873cbeb6..2168fc1254c76089f99369f76d541620020f6b57 100644 (file)
@@ -1 +1 @@
-@font-face{font-family:'XoloniumNormal';src:url('fonts/xolonium-webfont.eot');src:url('fonts/xolonium-webfont.eot?#iefix') format('embedded-opentype'),url('fonts/xolonium-webfont.woff') format('woff'),url('fonts/xolonium-webfont.ttf') format('truetype'),url('fonts/xolonium-webfont.svg#XoloniumNormal') format('svg');font-weight:normal;font-style:normal}body{background:url("img/web_background_4.jpg") no-repeat fixed center center / cover black;background-color:black;color:#d0d0d0;font-family:"XoloniumNormal","Helvetica Neue",Helvetica,Arial,sans-serif}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;color:#999}h1{font-size:30px;line-height:36px}h1 small{font-size:18px}h2{font-size:24px;line-height:36px}h2 small{font-size:18px}h3{line-height:27px;font-size:18px}h3 small{font-size:14px}h4,h5,h6{line-height:18px}h4{font-size:14px}h4 small{font-size:12px}h5{font-size:12px}h6{font-size:11px;color:#999;text-transform:uppercase}table{background:#000;background:none repeat scroll 0 0 rgba(0,0,0,0.7);border:1px solid #436688}table th{border:1px solid #436688;background-color:#001021}table td{border:1px solid #436688;font-size:10px}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#222}.table th,.table td{border:1px solid #436688}.table td{vertical-align:middle}.table .tdcenter{text-align:center}.accordion-group{border:1px solid #272525}.accordion-inner{border:0}#statline{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;position:relative;top:-25px}#xonborder{background:#000;background:none repeat scroll 0 0 rgba(0,0,0,0.5);border-radius:15px 15px 15px 15px;margin-bottom:30px;margin-left:0;padding:20px}#title{color:#08c;font-size:30px;margin-bottom:15px;position:relative;text-align:center;text-shadow:2px 2px 3px #333}.indexform{margin:20px 0 20px 0}.indexbox{width:250px}.navbar-brand{margin-left:0;padding-bottom:0;padding-top:10px;text-align:left}.navbar-inverse{background:none repeat scroll 0 0 rgba(0,0,0,0.6)}.navbar-inverse .nav>.active>a,.navbar-inverse .nav>.active>a:hover,.navbar-inverse .nav>.active>a:focus{background:none repeat scroll 0 0 rgba(49,49,49,0.6)}.navbar-inverse .nav>li>a,.navbar-brand{font-family:XoloniumNormal}.search,input[type="search"]{background-color:#606060;border:1px solid #202020;color:#aaa;width:100px}.game{float:left;margin-bottom:30px;min-width:700px;padding:10px 7px}.game a{color:#CCC}.game a:hover{color:#d95f00;text-decoration:none}.game tr{background-color:#000}.game tr.red{background-color:#4d0000}.game tr.blue{background-color:#00004d}.game tr.yellow{background-color:#4d4d00}.game tr.pink{background-color:#4d004d}.game tr:hover{background-color:#222}.weapon-nav{height:70px;margin-bottom:20px}.weapon-nav ul{display:block;list-style:none outside none}.weapon-nav li{cursor:pointer;float:left;margin-right:10px}.weapon-nav li:hover{border-bottom:2px solid #001021}.weapon-nav .weapon-active{border-bottom:2px solid #436688}.weapon-nav p{text-align:center}.flot table,.flot td{background-color:black;border:0}#gbtabcontainer{margin-top:10px}#gbtab{font-size:12px}.tabbable p{font-size:14px}.tabs-below .nav-tabs>li>a{border-radius:4px 4px 4px 4px}.nav-tabs>.active>a,.nav-tabs>.active>a:hover{background-color:#111;color:#aaa;border-color:#222}.nav-tabs>li>a{border-radius:4px 4px 4px 4px;text-align:center}.nav-tabs>li>a:hover{background-color:#111;border-color:#333}.nav-tabs{border-bottom:0 solid #000}.table .tdcenter{text-align:center}.game-detail img{float:left;margin-right:10px;margin-bottom:5px}.game img{float:left;margin-right:5px;margin-bottom:5px}.game-detail p,.game h4{float:left}.eloup{color:green}.elodown{color:#be0000}.eloneutral{color:gray}.player-nick{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pagination>li>a,.pagination>li>span{background-color:#111;border-color:#313131;color:#797979}.pagination>li>a:hover,.pagination>li>a:focus,.pagination>.active>a,.pagination>.active>span{background-color:#2b2222}@media(min-width:768px){.navbar-form{float:right}}
\ No newline at end of file
+@font-face{font-family:'XoloniumNormal';src:url('fonts/xolonium-webfont.eot');src:url('fonts/xolonium-webfont.eot?#iefix') format('embedded-opentype'),url('fonts/xolonium-webfont.woff') format('woff'),url('fonts/xolonium-webfont.ttf') format('truetype'),url('fonts/xolonium-webfont.svg#XoloniumNormal') format('svg');font-weight:normal;font-style:normal}body{background:url("img/web_background_4.jpg") no-repeat fixed center center / cover black;background-color:black;color:#d0d0d0;font-family:"XoloniumNormal","Helvetica Neue",Helvetica,Arial,sans-serif}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;color:#999}h1{font-size:30px;line-height:36px}h1 small{font-size:18px}h2{font-size:24px;line-height:36px}h2 small{font-size:18px}h3{line-height:27px;font-size:18px}h3 small{font-size:14px}h4,h5,h6{line-height:18px}h4{font-size:14px}h4 small{font-size:12px}h5{font-size:12px}h6{font-size:11px;color:#999;text-transform:uppercase}table{background:#000;background:none repeat scroll 0 0 rgba(0,0,0,0.7);border:1px solid #436688}table th{border:1px solid #436688;background-color:#001021}table td{border:1px solid #436688;font-size:10px}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#222}.table th,.table td{border:1px solid #436688}.table td{vertical-align:middle}.table .tdcenter{text-align:center}.accordion-group{border:1px solid #272525}.accordion-inner{border:0}#statline{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;position:relative;top:-25px}#xonborder{background:#000;background:none repeat scroll 0 0 rgba(0,0,0,0.5);border-radius:15px 15px 15px 15px;margin-bottom:30px;margin-left:0;padding:20px}#title{color:#08c;font-size:30px;margin-bottom:15px;position:relative;text-align:center;text-shadow:2px 2px 3px #333}.indexform{margin:20px 0 20px 0}.indexbox{width:250px}.navbar-brand{margin-left:0;padding-bottom:0;padding-top:10px;text-align:left}.navbar-inverse{background:none repeat scroll 0 0 rgba(0,0,0,0.6)}.navbar-inverse .nav>.active>a,.navbar-inverse .nav>.active>a:hover,.navbar-inverse .nav>.active>a:focus{background:none repeat scroll 0 0 rgba(49,49,49,0.6)}.navbar-inverse .nav>li>a,.navbar-brand{font-family:XoloniumNormal}.search,input[type="search"]{background-color:#606060;border:1px solid #202020;color:#aaa;width:100px}.game{float:left;margin-bottom:30px;min-width:700px;padding:10px 7px}.game a{color:#CCC}.game a:hover{color:#d95f00;text-decoration:none}.game tr{background-color:#000}.game tr.red{background-color:#4d0000}.game tr.blue{background-color:#00004d}.game tr.yellow{background-color:#4d4d00}.game tr.pink{background-color:#4d004d}.game tr:hover{background-color:#222}.teamscores td{background-color:#000;text-align:center;padding:4px;font-size:18px}.teamscores td.red{background-color:#4d0000}.teamscores td.blue{background-color:#00004d}.teamscores td.yellow{background-color:#4d4d00}.teamscores td.pink{background-color:#4d004d}.weapon-nav{height:70px;margin-bottom:20px}.weapon-nav ul{display:block;list-style:none outside none}.weapon-nav li{cursor:pointer;float:left;margin-right:10px}.weapon-nav li:hover{border-bottom:2px solid #001021}.weapon-nav .weapon-active{border-bottom:2px solid #436688}.weapon-nav p{text-align:center}.flot table,.flot td{background-color:black;border:0}#gbtabcontainer{margin-top:10px}#gbtab{font-size:12px}.tabbable p{font-size:14px}.tabs-below .nav-tabs>li>a{border-radius:4px 4px 4px 4px}.nav-tabs>.active>a,.nav-tabs>.active>a:hover{background-color:#111;color:#aaa;border-color:#222}.nav-tabs>li>a{border-radius:4px 4px 4px 4px;text-align:center}.nav-tabs>li>a:hover{background-color:#111;border-color:#333}.nav-tabs{border-bottom:0 solid #000}.table .tdcenter{text-align:center}.game-detail img{float:left;margin-right:10px;margin-bottom:5px}.game img{float:left;margin-right:5px;margin-bottom:5px}.game-detail p,.game h4{float:left}.eloup{color:green}.elodown{color:#be0000}.eloneutral{color:gray}.nostretch{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pagination>li>a,.pagination>li>span{background-color:#111;border-color:#313131;color:#797979}.pagination>li>a:hover,.pagination>li>a:focus,.pagination>.active>a,.pagination>.active>span{background-color:#2b2222}@media(min-width:768px){.navbar-form{float:right}}
index 44068d0f3bf2b956a6d411d3b97326ccb4523b95..1f4f51f8321bc74f0420b5601cc1dc81152a6456 100644 (file)
@@ -1,5 +1,17 @@
 <%def name="scoreboard(game_type_cd, pgstats, show_elo=False, show_latency=False)">
-<table  class="table table-hover table-condensed">
+% if teamscores:
+<table class="table table-condensed">
+<!--<thead><tr>
+  <td class="teamscore" colspan="${len(teamscores)}">Teamscores</td>
+</tr></thead>-->
+<tbody><tr class="teamscores">
+% for team,score in sorted(teamscores.items(), key=lambda x:x[1], reverse=True):
+    <td class="${team}">${score}</td>
+% endfor
+  </tr></tbody>
+</table>
+% endif
+<table class="table table-hover table-condensed">
   ${scoreboard_header(game_type_cd, pgstats[0])}
   <tbody>
   % for pgstat in pgstats:
index f1ba46132d09f330529edf9aafa8f3f994605c2e..f0fc1ce387e5ae0971d00dde58cfae28058f7c42 100644 (file)
@@ -113,6 +113,19 @@ def _game_info_data(request):
 
             captimes = sorted(captimes, key=lambda x:x.fastest)
 
+        teamscores = {}
+        for pgstat in pgstats:
+            if pgstat.team in [5,14,13,10]:
+                team = pgstat.team_html_color()
+                if pgstat.teamscore is not None:
+                    if not teamscores.has_key(team):
+                        teamscores[team] = pgstat.teamscore
+                    else:
+                        if teamscores[team] != pgstat.teamscore:  # this should not happen!
+                            teamscores[team] = None
+        if len(teamscores) == 0:
+            teamscores = None
+
         pwstats = {}
         for (pwstat, pgstat, weapon) in DBSession.query(PlayerWeaponStat, PlayerGameStat, Weapon).\
                 filter(PlayerWeaponStat.game_id == game_id).\
@@ -141,6 +154,7 @@ def _game_info_data(request):
         pgstats = None
         pwstats = None
         captimes = None
+        teamscores = None
         show_elo = False
         show_latency = False
         raise inst
@@ -152,6 +166,7 @@ def _game_info_data(request):
             'pgstats':pgstats,
             'pwstats':pwstats,
             'captimes':captimes,
+            'teamscores':teamscores,
             'show_elo':show_elo,
             'show_latency':show_latency,
             }
index fd70934d0d53d8744059b0067b81df7d7b87c764..399654c07f873e24cf0d2389561daddb37a58f0f 100644 (file)
@@ -632,6 +632,7 @@ def create_game_stat(session, game_meta, game, server, gmap, player, events):
         if key == 'scoreboard-pickups': pgstat.pickups = int(value)\r
         if key == 'scoreboard-caps': pgstat.captures = int(value)\r
         if key == 'scoreboard-score': pgstat.score = int(round(float(value)))\r
+        if key == 'scoreboard-teamscore': pgstat.teamscore = int(round(float(value)))\r
         if key == 'scoreboard-deaths': pgstat.deaths = int(value)\r
         if key == 'scoreboard-kills': pgstat.kills = int(value)\r
         if key == 'scoreboard-suicides': pgstat.suicides = int(value)\r