Commit c07cfcf9 authored by Antek Grzanka's avatar Antek Grzanka

Fixed #104.

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