Commit c07cfcf9 authored by Antek Grzanka's avatar Antek Grzanka

Fixed #104.

parent cb0efb72
(function(){ (function(){
angular.module('ctfApp').factory('APIProvider', ['$http', 'AppSettings', 'AuthenticationService', function($http, AppSettings, AuthenticationService){ angular.module('ctfApp').factory('APIProvider', ['$http', 'AppSettings', 'AuthenticationService', function($http, AppSettings, AuthenticationService){
var tasks, teams, scores; var tasks, teams, scores, myResults;
return { return {
...@@ -31,17 +31,28 @@ ...@@ -31,17 +31,28 @@
}, },
getMySolutions: function(callback){ getMySolutions: function(callback){
var result; if (!myResults){
if (!scores){ $http.get(AppSettings.getApiAddress() + '/solutions/my').
this.getScores(function(data){ success(function(data) {
result = this.getMySolutions(callback); myResults = data;
}.bind(this)); if (callback) callback(data);
});
} }
else { else {
var team = AuthenticationService.getTeamname(); callback(myResults);
result = team ? scores[team] : undefined;
} }
callback(result);
//var result;
//if (!scores){
// this.getScores(function(data){
// result = this.getMySolutions(callback);
// }.bind(this));
//}
//else {
// var team = AuthenticationService.getTeamname();
// result = team ? scores[team] : undefined;
//}
//callback(result);
}, },
getTaskById: function(id, callback){ getTaskById: function(id, callback){
......
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