diff --git a/api.go b/api.go
index 670d5fe..b991998 100644
--- a/api.go
+++ b/api.go
@@ -7,7 +7,6 @@ package main
import (
"encoding/json"
- "io"
"net/http"
)
@@ -23,14 +22,31 @@ func RankingsApiHandler(w http.ResponseWriter, r *http.Request) {
rankings = make([]Ranking, 0)
}
- data, err := json.MarshalIndent(rankings, "", " ")
+ // Get the last match scored so we can report that on the display.
+ matches, err := db.GetMatchesByType("qualification")
+ if err != nil {
+ handleWebErr(w, err)
+ return
+ }
+ highestPlayedMatch := ""
+ for _, match := range matches {
+ if match.Status == "complete" {
+ highestPlayedMatch = match.DisplayName
+ }
+ }
+
+ data := struct {
+ Rankings []Ranking
+ HighestPlayedMatch string
+ }{rankings, highestPlayedMatch}
+ jsonData, err := json.MarshalIndent(data, "", " ")
if err != nil {
handleWebErr(w, err)
return
}
w.Header().Set("Content-Type", "application/json")
- _, err = io.WriteString(w, string(data))
+ _, err = w.Write(jsonData)
if err != nil {
handleWebErr(w, err)
return
diff --git a/api_test.go b/api_test.go
index 1fe1f50..8fedfc5 100644
--- a/api_test.go
+++ b/api_test.go
@@ -18,21 +18,30 @@ func TestRankingsApi(t *testing.T) {
recorder := getHttpResponse("/api/rankings")
assert.Equal(t, 200, recorder.Code)
assert.Equal(t, "application/json", recorder.HeaderMap["Content-Type"][0])
- assert.Equal(t, "[]", recorder.Body.String())
+ rankingsData := struct {
+ Rankings []Ranking
+ HighestPlayedMatch string
+ }{}
+ err := json.Unmarshal([]byte(recorder.Body.String()), &rankingsData)
+ assert.Nil(t, err)
+ assert.Equal(t, 0, len(rankingsData.Rankings))
+ assert.Equal(t, "", rankingsData.HighestPlayedMatch)
ranking1 := Ranking{1114, 2, 18, 1100, 625, 90, 554, 0.254, 9, 1, 0, 0, 10}
ranking2 := Ranking{254, 1, 20, 1100, 625, 90, 554, 0.254, 10, 0, 0, 0, 10}
db.CreateRanking(&ranking1)
db.CreateRanking(&ranking2)
+ db.CreateMatch(&Match{Type: "qualification", DisplayName: "29", Status: "complete"})
+ db.CreateMatch(&Match{Type: "qualification", DisplayName: "30"})
recorder = getHttpResponse("/api/rankings")
assert.Equal(t, 200, recorder.Code)
assert.Equal(t, "application/json", recorder.HeaderMap["Content-Type"][0])
- var jsonRankings []Ranking
- err := json.Unmarshal([]byte(recorder.Body.String()), &jsonRankings)
+ err = json.Unmarshal([]byte(recorder.Body.String()), &rankingsData)
assert.Nil(t, err)
- if assert.Equal(t, 2, len(jsonRankings)) {
- assert.Equal(t, ranking1, jsonRankings[1])
- assert.Equal(t, ranking2, jsonRankings[0])
+ if assert.Equal(t, 2, len(rankingsData.Rankings)) {
+ assert.Equal(t, ranking1, rankingsData.Rankings[1])
+ assert.Equal(t, ranking2, rankingsData.Rankings[0])
}
+ assert.Equal(t, "29", rankingsData.HighestPlayedMatch)
}
diff --git a/displays.go b/displays.go
new file mode 100644
index 0000000..d8021fd
--- /dev/null
+++ b/displays.go
@@ -0,0 +1,28 @@
+// Copyright 2014 Team 254. All Rights Reserved.
+// Author: pat@patfairbank.com (Patrick Fairbank)
+//
+// Web handlers for displays.
+
+package main
+
+import (
+ "net/http"
+ "text/template"
+)
+
+// Renders the pit display which shows scrolling rankings.
+func PitDisplayHandler(w http.ResponseWriter, r *http.Request) {
+ template, err := template.ParseFiles("templates/pit_display.html")
+ if err != nil {
+ handleWebErr(w, err)
+ return
+ }
+ data := struct {
+ *EventSettings
+ }{eventSettings}
+ err = template.Execute(w, data)
+ if err != nil {
+ handleWebErr(w, err)
+ return
+ }
+}
diff --git a/displays_test.go b/displays_test.go
new file mode 100644
index 0000000..5e92d4f
--- /dev/null
+++ b/displays_test.go
@@ -0,0 +1,23 @@
+// Copyright 2014 Team 254. All Rights Reserved.
+// Author: pat@patfairbank.com (Patrick Fairbank)
+
+package main
+
+import (
+ "github.com/stretchr/testify/assert"
+ "testing"
+)
+
+func TestPitDisplay(t *testing.T) {
+ clearDb()
+ defer clearDb()
+ var err error
+ db, err = OpenDatabase(testDbPath)
+ assert.Nil(t, err)
+ defer db.Close()
+ eventSettings, _ = db.GetEventSettings()
+
+ recorder := getHttpResponse("/displays/pit")
+ assert.Equal(t, 200, recorder.Code)
+ assert.Contains(t, recorder.Body.String(), "Cheesy Arena - Untitled Event - Pit Display")
+}
diff --git a/static/css/fonts/roboto-regular/Roboto-Regular-webfont.eot b/static/css/fonts/roboto-regular/Roboto-Regular-webfont.eot
deleted file mode 100644
index 9b5e8e4..0000000
Binary files a/static/css/fonts/roboto-regular/Roboto-Regular-webfont.eot and /dev/null differ
diff --git a/static/css/fonts/roboto-regular/Roboto-Regular-webfont.svg b/static/css/fonts/roboto-regular/Roboto-Regular-webfont.svg
deleted file mode 100644
index de7d77f..0000000
--- a/static/css/fonts/roboto-regular/Roboto-Regular-webfont.svg
+++ /dev/null
@@ -1,621 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/static/css/fonts/roboto-regular/Roboto-Regular-webfont.ttf b/static/css/fonts/roboto-regular/Roboto-Regular-webfont.ttf
deleted file mode 100644
index 44dd78d..0000000
Binary files a/static/css/fonts/roboto-regular/Roboto-Regular-webfont.ttf and /dev/null differ
diff --git a/static/css/fonts/roboto-regular/Roboto-Regular-webfont.woff b/static/css/fonts/roboto-regular/Roboto-Regular-webfont.woff
deleted file mode 100644
index bfa05d5..0000000
Binary files a/static/css/fonts/roboto-regular/Roboto-Regular-webfont.woff and /dev/null differ
diff --git a/static/css/fonts/roboto-regular/stylesheet.css b/static/css/fonts/roboto-regular/stylesheet.css
deleted file mode 100644
index 45a4ab9..0000000
--- a/static/css/fonts/roboto-regular/stylesheet.css
+++ /dev/null
@@ -1,12 +0,0 @@
-@font-face {
- font-family: 'robotoregular';
- src: url('Roboto-Regular-webfont.eot');
- src: url('Roboto-Regular-webfont.eot?#iefix') format('embedded-opentype'),
- url('Roboto-Regular-webfont.woff') format('woff'),
- url('Roboto-Regular-webfont.ttf') format('truetype'),
- url('Roboto-Regular-webfont.svg#robotoregular') format('svg');
- font-weight: normal;
- font-style: normal;
-
-}
-
diff --git a/static/css/pit_display.css b/static/css/pit_display.css
new file mode 100644
index 0000000..5b8e888
--- /dev/null
+++ b/static/css/pit_display.css
@@ -0,0 +1,72 @@
+/*
+Copyright 2014 Team 254. All Rights Reserved.
+Author: nick@team254.com (Nick Eyre)
+*/
+
+html {
+ height: 100%;
+ cursor: default;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+}
+body {
+ height: 100%;
+ background: -moz-linear-gradient(top, #003375 1%, #3C679D 100%); /* FF3.6+ */
+ background: -webkit-linear-gradient(top, #003375 1%, #3C679D 100%); /* Chrome10+,Safari5.1+ */
+ background: -webkit-linear-gradient(top, #003375 1%, #3C679D 100%); /* Chrome10+,Safari5.1+ */
+ background-repeat: no-repeat;
+ font-family: sans-serif;
+}
+#column {
+ width: 80%;
+ height: 100%;
+ margin: 0 auto;
+}
+#titlebar {
+ padding: 20px 0px;
+ line-height: 50px;
+ font-size: 40px;
+ font-weight: bold;
+ color: #fff;
+}
+#logo {
+ height: 50px;
+}
+#standings {
+ border-radius: 10px;
+ background-color: #fff;
+ padding: 10px;
+ height: 85%;
+}
+#header {
+ width: 100%;
+ text-align: center;
+ font-size: 15px;
+ font-weight: bold;
+ color: #000;
+ border-bottom: 1px solid #000;
+}
+#container {
+ height: 93%;
+ overflow-y: hidden;
+}
+#footer {
+ text-align: right;
+ font-size: 15px;
+ color: #000;
+ border-top: 1px solid #000;
+}
+.rankings-table {
+ text-align: center;
+ font-size: 17px;
+ color: #000;
+ border-bottom: 3px solid #666;
+ margin: 0;
+}
+.rankings-table > tbody > tr > td {
+ padding-left: 0;
+ padding-right: 0;
+}
+.align-left {
+ text-align: left;
+}
diff --git a/static/css/rankings.css b/static/css/rankings.css
deleted file mode 100644
index 5283024..0000000
--- a/static/css/rankings.css
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-Copyright 2014 Team 254. All Rights Reserved.
-Author: nick@team254.com (Nick Eyre)
-*/
-
-body {
- font-family: 'robotoregular';
- position: fixed;
- font-size: 2em;
- /*cursor: none;*/
-}
-
-#titlebar {
- position: fixed;
- top: 0;
- right: 0;
- left: 0;
- padding: .2em 1em;
- font-size: 2em;
-}
-#titlebar img {
- height: 1em;
- position: fixed;
- top: .4em;
- right: 1em;
-}
-
-#header {
- position: fixed;
- left: 0;
- top: 4em;
- width: 100%;
- background-color: #0070ff;
- color: white;
-}
-#container {
- position: fixed;
- top: 5.9em;
- bottom: 1.8em;
- right: 0;
- left: 0;
- overflow-y: scroll;
- text-align: right;
-}
-::-webkit-scrollbar {
- display: none;
-}
-table {
- width: 100%;
- text-align: right;
-}
-td {
- padding: 0.2em 1em;
-}
-.left {
- text-align: left;
-}
-#container tr:nth-child(even) {
- background-color: #ddd;
-}
-#footer {
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- background: white;
- padding: 0.2em 1em;
- border-top: 1px solid black;
-}
-#footer .right {
- float: right;
-}
\ No newline at end of file
diff --git a/static/img/eventlogo-flat.png b/static/img/logo.png
similarity index 100%
rename from static/img/eventlogo-flat.png
rename to static/img/logo.png
diff --git a/static/js/jquery.transit.min.js b/static/js/jquery.transit.min.js
new file mode 100644
index 0000000..7d653ac
--- /dev/null
+++ b/static/js/jquery.transit.min.js
@@ -0,0 +1 @@
+(function(t,e){if(typeof define==="function"&&define.amd){define(["jquery"],e)}else if(typeof exports==="object"){module.exports=e(require("jquery"))}else{e(t.jQuery)}})(this,function(t){t.transit={version:"0.9.11",propertyMap:{marginLeft:"margin",marginRight:"margin",marginBottom:"margin",marginTop:"margin",paddingLeft:"padding",paddingRight:"padding",paddingBottom:"padding",paddingTop:"padding"},enabled:true,useTransitionEnd:false};var e=document.createElement("div");var n={};function i(t){if(t in e.style)return t;var n=["Moz","Webkit","O","ms"];var i=t.charAt(0).toUpperCase()+t.substr(1);for(var r=0;r-1;n.transition=i("transition");n.transitionDelay=i("transitionDelay");n.transform=i("transform");n.transformOrigin=i("transformOrigin");n.filter=i("Filter");n.transform3d=r();var a={transition:"transitionend",MozTransition:"transitionend",OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",msTransition:"MSTransitionEnd"};var o=n.transitionEnd=a[n.transition]||null;for(var u in n){if(n.hasOwnProperty(u)&&typeof t.support[u]==="undefined"){t.support[u]=n[u]}}e=null;t.cssEase={_default:"ease","in":"ease-in",out:"ease-out","in-out":"ease-in-out",snap:"cubic-bezier(0,1,.5,1)",easeInCubic:"cubic-bezier(.550,.055,.675,.190)",easeOutCubic:"cubic-bezier(.215,.61,.355,1)",easeInOutCubic:"cubic-bezier(.645,.045,.355,1)",easeInCirc:"cubic-bezier(.6,.04,.98,.335)",easeOutCirc:"cubic-bezier(.075,.82,.165,1)",easeInOutCirc:"cubic-bezier(.785,.135,.15,.86)",easeInExpo:"cubic-bezier(.95,.05,.795,.035)",easeOutExpo:"cubic-bezier(.19,1,.22,1)",easeInOutExpo:"cubic-bezier(1,0,0,1)",easeInQuad:"cubic-bezier(.55,.085,.68,.53)",easeOutQuad:"cubic-bezier(.25,.46,.45,.94)",easeInOutQuad:"cubic-bezier(.455,.03,.515,.955)",easeInQuart:"cubic-bezier(.895,.03,.685,.22)",easeOutQuart:"cubic-bezier(.165,.84,.44,1)",easeInOutQuart:"cubic-bezier(.77,0,.175,1)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)",easeInSine:"cubic-bezier(.47,0,.745,.715)",easeOutSine:"cubic-bezier(.39,.575,.565,1)",easeInOutSine:"cubic-bezier(.445,.05,.55,.95)",easeInBack:"cubic-bezier(.6,-.28,.735,.045)",easeOutBack:"cubic-bezier(.175, .885,.32,1.275)",easeInOutBack:"cubic-bezier(.68,-.55,.265,1.55)"};t.cssHooks["transit:transform"]={get:function(e){return t(e).data("transform")||new f},set:function(e,i){var r=i;if(!(r instanceof f)){r=new f(r)}if(n.transform==="WebkitTransform"&&!s){e.style[n.transform]=r.toString(true)}else{e.style[n.transform]=r.toString()}t(e).data("transform",r)}};t.cssHooks.transform={set:t.cssHooks["transit:transform"].set};t.cssHooks.filter={get:function(t){return t.style[n.filter]},set:function(t,e){t.style[n.filter]=e}};if(t.fn.jquery<"1.8"){t.cssHooks.transformOrigin={get:function(t){return t.style[n.transformOrigin]},set:function(t,e){t.style[n.transformOrigin]=e}};t.cssHooks.transition={get:function(t){return t.style[n.transition]},set:function(t,e){t.style[n.transition]=e}}}p("scale");p("scaleX");p("scaleY");p("translate");p("rotate");p("rotateX");p("rotateY");p("rotate3d");p("perspective");p("skewX");p("skewY");p("x",true);p("y",true);function f(t){if(typeof t==="string"){this.parse(t)}return this}f.prototype={setFromString:function(t,e){var n=typeof e==="string"?e.split(","):e.constructor===Array?e:[e];n.unshift(t);f.prototype.set.apply(this,n)},set:function(t){var e=Array.prototype.slice.apply(arguments,[1]);if(this.setter[t]){this.setter[t].apply(this,e)}else{this[t]=e.join(",")}},get:function(t){if(this.getter[t]){return this.getter[t].apply(this)}else{return this[t]||0}},setter:{rotate:function(t){this.rotate=y(t,"deg")},rotateX:function(t){this.rotateX=y(t,"deg")},rotateY:function(t){this.rotateY=y(t,"deg")},scale:function(t,e){if(e===undefined){e=t}this.scale=t+","+e},skewX:function(t){this.skewX=y(t,"deg")},skewY:function(t){this.skewY=y(t,"deg")},perspective:function(t){this.perspective=y(t,"px")},x:function(t){this.set("translate",t,null)},y:function(t){this.set("translate",null,t)},translate:function(t,e){if(this._translateX===undefined){this._translateX=0}if(this._translateY===undefined){this._translateY=0}if(t!==null&&t!==undefined){this._translateX=y(t,"px")}if(e!==null&&e!==undefined){this._translateY=y(e,"px")}this.translate=this._translateX+","+this._translateY}},getter:{x:function(){return this._translateX||0},y:function(){return this._translateY||0},scale:function(){var t=(this.scale||"1,1").split(",");if(t[0]){t[0]=parseFloat(t[0])}if(t[1]){t[1]=parseFloat(t[1])}return t[0]===t[1]?t[0]:t},rotate3d:function(){var t=(this.rotate3d||"0,0,0,0deg").split(",");for(var e=0;e<=3;++e){if(t[e]){t[e]=parseFloat(t[e])}}if(t[3]){t[3]=y(t[3],"deg")}return t}},parse:function(t){var e=this;t.replace(/([a-zA-Z0-9]+)\((.*?)\)/g,function(t,n,i){e.setFromString(n,i)})},toString:function(t){var e=[];for(var i in this){if(this.hasOwnProperty(i)){if(!n.transform3d&&(i==="rotateX"||i==="rotateY"||i==="perspective"||i==="transformOrigin")){continue}if(i[0]!=="_"){if(t&&i==="scale"){e.push(i+"3d("+this[i]+",1)")}else if(t&&i==="translate"){e.push(i+"3d("+this[i]+",0)")}else{e.push(i+"("+this[i]+")")}}}}return e.join(" ")}};function c(t,e,n){if(e===true){t.queue(n)}else if(e){t.queue(e,n)}else{t.each(function(){n.call(this)})}}function l(e){var i=[];t.each(e,function(e){e=t.camelCase(e);e=t.transit.propertyMap[e]||t.cssProps[e]||e;e=h(e);if(n[e])e=h(n[e]);if(t.inArray(e,i)===-1){i.push(e)}});return i}function d(e,n,i,r){var s=l(e);if(t.cssEase[i]){i=t.cssEase[i]}var a=""+b(n)+" "+i;if(parseInt(r,10)>0){a+=" "+b(r)}var o=[];t.each(s,function(t,e){o.push(e+" "+a)});return o.join(", ")}t.fn.transition=t.fn.transit=function(e,i,r,s){var a=this;var u=0;var f=true;var l=jQuery.extend(true,{},e);if(typeof i==="function"){s=i;i=undefined}if(typeof i==="object"){r=i.easing;u=i.delay||0;f=typeof i.queue==="undefined"?true:i.queue;s=i.complete;i=i.duration}if(typeof r==="function"){s=r;r=undefined}if(typeof l.easing!=="undefined"){r=l.easing;delete l.easing}if(typeof l.duration!=="undefined"){i=l.duration;delete l.duration}if(typeof l.complete!=="undefined"){s=l.complete;delete l.complete}if(typeof l.queue!=="undefined"){f=l.queue;delete l.queue}if(typeof l.delay!=="undefined"){u=l.delay;delete l.delay}if(typeof i==="undefined"){i=t.fx.speeds._default}if(typeof r==="undefined"){r=t.cssEase._default}i=b(i);var p=d(l,i,r,u);var h=t.transit.enabled&&n.transition;var y=h?parseInt(i,10)+parseInt(u,10):0;if(y===0){var g=function(t){a.css(l);if(s){s.apply(a)}if(t){t()}};c(a,f,g);return a}var m={};var v=function(i){var r=false;var u=function(){if(r){a.unbind(o,u)}if(y>0){a.each(function(){this.style[n.transition]=m[this]||null})}if(typeof s==="function"){s.apply(a)}if(typeof i==="function"){i()}};if(y>0&&o&&t.transit.useTransitionEnd){r=true;a.bind(o,u)}else{window.setTimeout(u,y)}a.each(function(){if(y>0){this.style[n.transition]=p}t(this).css(e)})};var z=function(t){this.offsetWidth;v(t)};c(a,f,z);return this};function p(e,i){if(!i){t.cssNumber[e]=true}t.transit.propertyMap[e]=n.transform;t.cssHooks[e]={get:function(n){var i=t(n).css("transit:transform");return i.get(e)},set:function(n,i){var r=t(n).css("transit:transform");r.setFromString(e,i);t(n).css({"transit:transform":r})}}}function h(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}function y(t,e){if(typeof t==="string"&&!t.match(/^[\-0-9\.]+$/)){return t}else{return""+t+e}}function b(e){var n=e;if(typeof n==="string"&&!n.match(/^[\-0-9\.]+/)){n=t.fx.speeds[n]||t.fx.speeds._default}return y(n,"ms")}t.transit.getTransitionValue=d;return t});
\ No newline at end of file
diff --git a/static/js/pit_display.js b/static/js/pit_display.js
new file mode 100644
index 0000000..18b0961
--- /dev/null
+++ b/static/js/pit_display.js
@@ -0,0 +1,84 @@
+// Copyright 2014 Team 254. All Rights Reserved.
+// Author: nick@team254.com (Nick Eyre)
+// Author: pat@patfairbank.com (Patrick Fairbank)
+//
+// Client-side methods for the pit display.
+
+var initial_dwell_ms = 3000;
+var scroll_ms_per_row = 700; // How long in milliseconds it takes to scroll a height of one row.
+var static_update_interval_ms = 10000; // How long between updates if not scrolling.
+var standingsTemplate = Handlebars.compile($("#standingsTemplate").html());
+var rankingsData;
+var rankingsIteration = 0;
+var prevHighestPlayedMatch;
+
+// Loads the JSON rankings data from the event server.
+var getRankingsData = function(callback) {
+ $.getJSON("/api/rankings", function(data) {
+ rankingsData = data;
+ if (callback) {
+ callback(data);
+ }
+ });
+};
+
+// Updates the rankings in place and initiates scrolling if they are long enough to require it.
+var updateStaticRankings = function() {
+ getRankingsData(function() {
+ var rankingsHtml = standingsTemplate(rankingsData);
+ $("#rankings2").html(rankingsHtml);
+ $("#scroller").css("transform", "translate(0px, -2px);");
+ prevHighestPlayedMatch = rankingsData.HighestPlayedMatch;
+ setHighestPlayedMatch(rankingsData.HighestPlayedMatch);
+ if ($("#rankings2").height() > $("#container").height()) {
+ // Initiate scrolling.
+ setTimeout(cycleRankings, initial_dwell_ms);
+ } else {
+ // Rankings are too short; just update in place.
+ setTimeout(updateStaticRankings, static_update_interval_ms);
+ }
+ });
+};
+
+// Seamlessly copies the newer table contents to the older one, resets the scrolling, and loads new data.
+var cycleRankings = function() {
+ // Overwrite the top data with the bottom data and reset the scrolling back up to the top of the top table.
+ $("#rankings1").html($("#rankings2").html());
+ $("#scroller").css({ transform: "translate(0px, -1px);" });
+
+ // Load new data into the now out-of-sight bottom table.
+ var rankingsHtml = standingsTemplate(rankingsData);
+ $("#rankings2").html(rankingsHtml);
+
+ // Delay updating the "Standings as of" message by one cycle because the tables are always one cycle behind
+ // the data loading.
+ setHighestPlayedMatch(prevHighestPlayedMatch);
+ prevHighestPlayedMatch = rankingsData.HighestPlayedMatch;
+
+ if ($("#rankings1").height() > $("#container").height()) {
+ // Kick off another scrolling animation.
+ var scrollDistance = $("#rankings1").height() + parseInt($("#rankings1").css("border-bottom-width"));
+ var scrollTime = scroll_ms_per_row * $("#rankings1 tr").length;
+ $("#scroller").transition({y: -scrollDistance}, scrollTime, "linear", cycleRankings);
+
+ // Set the data to be reloaded two seconds before the scrolling terminates.
+ var reloadDataTime = Math.max(0, scrollTime - 2000);
+ setTimeout(getRankingsData, reloadDataTime);
+ } else {
+ // The rankings got shorter for whatever reason, so revert to static updating.
+ setTimeout(updateStaticRankings, static_update_interval_ms);
+ }
+};
+
+// Updates the "Standings as of" message with the given value, or blanks it out if there is no data yet.
+var setHighestPlayedMatch = function(highestPlayedMatch) {
+ if (highestPlayedMatch == "") {
+ $("#highestPlayedMatch").text("");
+ } else {
+ $("#highestPlayedMatch").text("Standings as of Qualification Match " + highestPlayedMatch);
+ }
+};
+
+$(function() {
+ updateStaticRankings();
+});
diff --git a/static/js/rankings.js b/static/js/rankings.js
deleted file mode 100644
index 27a591d..0000000
--- a/static/js/rankings.js
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2014 Team 254. All Rights Reserved.
-// Author: nick@team254.com (Nick Eyre)
-
-initialize();
-
-var template;
-function initialize(){
- getData(populateView);
- template = Handlebars.compile($('#row-template').html());
-}
-
-var rankings;
-function getData(callback){
- $.getJSON('/reports/json/rankings', function(data){
- data = {teams: data};
- rankings = data;
- if(typeof(callback) == "function")
- callback();
- var date = new Date();
- console.log("New Data Acquired\n"+date);
- });
-}
-
-function populateView(){
- $('#container table').html(template(rankings));
- equalize();
- setTimeout(scroll, PAUSE_TIME);
-}
-
-// Balance Column Widths
-var widths = [];
-function equalize(){
- $('#container #new tr').first().children('td').each(function(){
- var width = $(this).width();
- widths.push(width);
- });
- $('#header').children('td').each(function(index){
- $(this).width(widths[index]);
- });
-}
-
-var SCROLL_SPEED = 1000; // Smaller is Faster
-function scroll(){
- $('#container').scrollTop(0);
-
- var offset = $('table#new').offset().top - $('#container').offset().top;
- var scrollTime = SCROLL_SPEED * $('table#old tr').length;
- $('#container').animate({scrollTop: offset}, scrollTime, 'linear', reset);
-
- $('#container table#new').html(template(rankings));
- equalize();
-
- interval = setInterval(pollForUpdate, POLL_INTERVAL);
-}
-
-var PAUSE_TIME = 5000;
-function reset(){
- $('#container table#old').html($('#container table#new').html());
- setTimeout(scroll, PAUSE_TIME);
-}
-
-var POLL_INTERVAL = 1000;
-function pollForUpdate(){
- if($('#container').offset().top * $('#container').height() > $('#container table#old tr').last().prev().offset().top){
- getData();
- clearInterval(interval);
- }
-}
\ No newline at end of file
diff --git a/static/rankings.html b/static/rankings.html
deleted file mode 100644
index 772fff1..0000000
--- a/static/rankings.html
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-
-
-
-
-
-
- Cheesy Arena - Rankings
-
-
-
-
-
-
-
-
- Event Rankings
-

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/templates/base.html b/templates/base.html
index 033d118..2748750 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -56,7 +56,7 @@
Display