Skip to content

Commit 48959a0

Browse files
author
Jon Myrick
authored
Merge pull request CodewarsClone#99 from CodewarsClone/branchWed
Branch wed
2 parents 3c123ef + 4eb132a commit 48959a0

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

db/read/kata_solutions.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
SELECT * FROM solutions
2-
WHERE kata_id = $1;
2+
WHERE kata_id = $1;

src/components/home/homeCtrl.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,25 @@ angular.module('app').controller('homeCtrl', function($scope, $state, mainServic
1313
console.log(response.data);
1414
mainService.user = response.data;
1515
mainService.user.kyu_level = mainService.rankCalculator(mainService.user);
16+
$scope.getUserKatas(mainService.user.id);
1617
$scope.getRandomKata();
1718
})
1819
}
1920

2021
$scope.getRandomKata = () => {
22+
let oldId;
23+
if ($scope.randomKata) {
24+
oldId = $scope.randomKata.id
25+
}
2126
mainService.getRandomKata(mainService.user.kyu_level).then(response => {
22-
console.log(response.data);
27+
28+
if (oldId) {
29+
if (response.data.id === oldId) {
30+
return $scope.getRandomKata(mainService.user.kyu_level);
31+
} else {
32+
return $scope.randomKata = response.data;
33+
}
34+
}
2335
$scope.randomKata = response.data;
2436
})
2537
}
@@ -43,7 +55,7 @@ angular.module('app').controller('homeCtrl', function($scope, $state, mainServic
4355

4456

4557
$scope.getUser();
46-
$scope.getUserKatas(mainService.user.id);
58+
4759

4860

4961
});

src/components/mainService.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,10 @@ angular.module('app').service('mainService', function($http, $q, $sce, $state) {
207207
};
208208

209209
this.checkAuth = () => {
210-
console.log('Hit check auth');
211210
$http({
212211
method: 'GET',
213212
url: `/api/check-auth`
214213
}).then(response => {
215-
console.log(response);
216214
}, response => {
217215
$state.go('login');
218216
})

0 commit comments

Comments
 (0)