Commit 20220c97 authored by Antek Grzanka's avatar Antek Grzanka

Scoreboard works. Minor UI fixes.

parent e5c9aaca
...@@ -90,6 +90,11 @@ ...@@ -90,6 +90,11 @@
<artifactId>angular-ui-router</artifactId> <artifactId>angular-ui-router</artifactId>
<version>0.2.17</version> <version>0.2.17</version>
</dependency> </dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>font-awesome</artifactId>
<version>4.5.0</version>
</dependency>
<dependency> <dependency>
<groupId>com.bazaarvoice.dropwizard</groupId> <groupId>com.bazaarvoice.dropwizard</groupId>
<artifactId>dropwizard-webjars-bundle</artifactId> <artifactId>dropwizard-webjars-bundle</artifactId>
......
no elo <div style="text-align:center">
\ No newline at end of file KrakYournet 7 coś tam elo EESTEC fajnie
</div>
<div style="text-align:center;width:100%">made with <i class="fa fa-heart"></i> by <a href="http://telephoners.agh.edu.pl" id="telephoners"><img src="/page/statics/img/logo_telephoners.svg"></img></a></div>
\ No newline at end of file
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<title>CTF</title> <title>CTF</title>
<link rel="stylesheet" href="/webjars/materializecss/css/materialize.min.css"> <link rel="stylesheet" href="/webjars/materializecss/css/materialize.min.css">
<link rel="stylesheet" href="/page/statics/libs/angular-materialize.css"> <link rel="stylesheet" href="/page/statics/libs/angular-materialize.css">
<link rel="stylesheet" href="/webjars/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/page/statics/css/main.css"> <link rel="stylesheet" href="/page/statics/css/main.css">
</head> </head>
......
endpoint: /solutions/all <div ng-controller="ScoreboardController" class="scores">
format:
{ <div id="scores">
"nazwa zadania": ["lista","druzyn","ktora","go","rozwiazala"], <div ng-repeat="(team, score) in teamsScores" id="col-{{team}}" data-score="{{score}}" style="left:0; width:0; background-color:#336699;" class="column">
"drugie zadanie": ["innalista","druzyn","ktora","go","rozwiazala"] <div>{{team}} - {{score}}</div>
} </div>
\ No newline at end of file </div>
</div>
...@@ -30,3 +30,23 @@ nav { ...@@ -30,3 +30,23 @@ nav {
50% { opacity:0; } 50% { opacity:0; }
100% { opacity:1; } 100% { opacity:1; }
} }
.column{
height: 50px;
line-height: 50px;
overflow: hidden;
margin-bottom:20px;
}
.column div {
margin-left: 15px;
}
#telephoners {
vertical-align: middle;
display: inline-block;
}
#telephoners img {
max-width: 100px;
}
\ No newline at end of file
...@@ -25,11 +25,13 @@ ...@@ -25,11 +25,13 @@
}); });
}); });
app.factory('AppSettings', function() { app.factory('AppSettings', function() {
return { return {
apiAddress: "http://localhost:8080" apiAddress: "http://localhost:8080"
} }
}); });
app.controller('TasksController', ['$scope', '$http', 'AppSettings', function($scope, $http, AppSettings) { app.controller('TasksController', ['$scope', '$http', 'AppSettings', function($scope, $http, AppSettings) {
$scope.apiAddress = AppSettings.apiAddress; $scope.apiAddress = AppSettings.apiAddress;
$http.get(AppSettings.apiAddress + '/tasks'). $http.get(AppSettings.apiAddress + '/tasks').
...@@ -39,6 +41,53 @@ ...@@ -39,6 +41,53 @@
}); });
}]); }]);
app.controller('ScoreboardController', ['$scope', '$http', 'AppSettings', function($scope, $http, AppSettings) {
var mock = { "nazwa zadania": ["lista","druzyn","ktora","rozwiazala"], "drugie zadanie": ["inna","druzyn","ktora","go"] };
var calculatePerTeam = function(data) {
var teams = {};
for (var key in data) {
if (data.hasOwnProperty(key)) {
var task = data[key];
for(var i = 0; i < task.length; i++){
if (!teams[task[i]]){
teams[task[i]] = 1;
}
else {
teams[task[i]] += 1;
}
}
}
}
return teams;
};
function viewGraph(){
$('.column').css('height','0');
console.log($scope.teamsScores);
setTimeout(function(){
$('.column').each(function(){
$(this).animate({width: 150*$(this).attr('data-score')}, 1500);
});
}
);
}
$http.get(AppSettings.apiAddress + '/solutions/all').
success(function(data) {
console.log(data);
if ($.isEmptyObject(data)){
data = mock; // Delete!
}
$scope.teamsScores = calculatePerTeam(data);
console.log($scope.teamsScores);
viewGraph()
});
}]);
})(); })();
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
this.stop = false; this.stop = false;
// custom cursor // custom cursor
this.cursorChar = this.options.cursorChar; this.cursorChar = '<a href="http://bit.do/aCoToChybaNieKolejnaFlaga">' + this.options.cursorChar + '</a>';
// shuffle the strings // shuffle the strings
this.shuffle = this.options.shuffle; this.shuffle = this.options.shuffle;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment