diff --git a/server.py b/server.py
index d429e31..0b2f0f6 100755
--- a/server.py
+++ b/server.py
@@ -27,6 +27,7 @@ class Map(db.Model):
map_uid = Column(String, primary_key=True)
mapname = Column(String)
+ game = Column(String)
def get_best_replay(self):
@@ -268,7 +269,7 @@ def replay_from_path(fullpath, uploader=None):
game=ghost.game)
# build database map object from replay #
- m = Map(map_uid=replay.map_uid, mapname=replay.map_uid)
+ m = Map(map_uid=replay.map_uid, mapname=replay.map_uid, game=replay.game)
# merge the map & commit and return the replay #
db.session.merge(m)
@@ -323,7 +324,18 @@ def mapnames():
# TODO list by user
player = flask.request.headers.get("X-Forwarded-Preferred-Username")
- maps = db.session.query(Map).order_by(asc(Map.mapname)).all()
+ maps_query = db.session.query(Map).order_by(asc(Map.mapname))
+
+ # limit leaderboard to game #
+ game = flask.request.args.get("game")
+ if game == "tm2020":
+ maps_query = maps_query.filter(Map.game=="tm2020")
+ elif game=="tmnf":
+ maps_query = maps_query.filter(Map.game!="tm2020")
+ else:
+ pass
+
+ maps = maps_query.all()
# FIXME better handling for unwanted maps #
allowed = ("A", "B", "C", "D", "E", "Fall", "Winter", "Spring", "Summer")
@@ -410,4 +422,4 @@ if __name__ == "__main__":
with app.app_context():
create_app()
- app.run(host=args.interface, port=args.port)
+ app.run(host=args.interface, port=args.port, debug=True)
diff --git a/static/site.css b/static/site.css
new file mode 100644
index 0000000..daf1c67
--- /dev/null
+++ b/static/site.css
@@ -0,0 +1,55 @@
+body{
+ background: #2b3035;
+}
+
+td{
+ border-bottom: 1px;
+ padding-top: 20px;
+ padding-bottom: 20px;
+ font-size: 17px !important;
+ background: #343a40;
+}
+tr{
+ margin-top: 2px;
+ margin-bottom: 2px;
+ color: white;
+}
+th{
+ margin-top: 2px;
+ margin-bottom: 2px;
+ font-weight: bold;
+}
+table{
+ border-collapse:separate;
+ border-spacing: 0 0.25em;
+ border-bottom: 3px solid;
+ border-color: transparent;
+}
+
+.m-auto{
+ margin: auto;
+}
+
+.margin-r{
+ margin-right: 20px;
+}
+
+.margin-l{
+ margin-left: 20px;
+}
+
+.margin-table-mid{
+ margin-left: 20px;
+}
+
+.self-record{
+ background: #354034;
+}
+
+select{
+ background: darkgray !important;
+}
+
+input{
+ background: darkgray !important;
+}
diff --git a/templates/datatable.html b/templates/datatable.html
index 4bc80a5..64584a0 100644
--- a/templates/datatable.html
+++ b/templates/datatable.html
@@ -1,5 +1,5 @@
-
diff --git a/templates/head.html b/templates/head.html
index d4d789a..68e91c6 100644
--- a/templates/head.html
+++ b/templates/head.html
@@ -24,5 +24,8 @@
+
+
+
diff --git a/templates/index.html b/templates/index.html
index d28b784..e8d5a13 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -3,41 +3,78 @@
{% include "upload-button.html" %}
-
+
+
+
+
- | Map |
+
+ Map
+ |
{% if player %}
- Personal Best |
+
+ Personal Best
+ |
{% endif %}
- Record |
- Record Holder |
- Record Age |
- Runner Up (%) |
+
+ Record
+ |
+
+ Record Holder
+ |
+
+ Record Age
+ |
+
+ Runner Up (%)
+ |
{% for map in maps %}
|
- {{ map.mapname }}
+ {{ map.mapname }}
|
{% if player %}
{% set pb = map.get_best_replay_for_player(player) %}
{% if pb and pb.race_time != map.get_best_replay().race_time %}
- {{ pb.get_human_readable_time() }} |
- {% elif pb %}
- CRH |
- {% else %}
- - |
- {% endif %}
+
+ {{ pb.get_human_readable_time() }}
+ |
+ {% elif pb %}
+
+ CRH
+ |
+ {% else %}
+
+ -
+ |
+ {% endif %}
{% endif %}
- {{ map.get_best_replay_repr().split(" ")[0] }} |
- {{ map.get_best_replay().clean_login() }} |
- {{ map.get_best_replay_age() }} days |
- {{ map.get_record_replay_percent_diff() }} |
+
+ {{ map.get_best_replay_repr().split(" ")[0] }}
+ |
+
+ {{ map.get_best_replay().clean_login() }}
+ |
+
+ {{ map.get_best_replay_age() }} days
+ |
+
+ {{ map.get_record_replay_percent_diff() }}
+ |
{% endfor %}
+
+
diff --git a/templates/map-info.html b/templates/map-info.html
index 7b891aa..c657b35 100644
--- a/templates/map-info.html
+++ b/templates/map-info.html
@@ -1,7 +1,7 @@
{% include "head.html" %}
-
+
{% include "upload-button.html" %}
{% include "home-button.html" %}