diff --git a/scripts/FeedController.js b/scripts/FeedController.js index 59fd93b..4a6e8e2 100644 --- a/scripts/FeedController.js +++ b/scripts/FeedController.js @@ -8,6 +8,7 @@ angular.module('flashy.FeedController', ['ui.router', 'ngAnimate']). return $state.go('addclass'); } $rootScope.currentSection = $rootScope.SectionResource.get({sectionId: sectionId}); + $rootScope.debug_flashcard = false; $scope.cards = false; $scope.cardCols = []; // organized data $scope.numCols = 0; @@ -118,8 +119,8 @@ angular.module('flashy.FeedController', ['ui.router', 'ngAnimate']). return -1; }; - $scope.update = function(id, new_score) { // NOT WORKING - /*card = $scope.cardTable[id].obj; + $scope.update = function(id, new_score) { + card = $scope.cardTable[id].obj; if (new_score == card.score) { console.log('score same, no update required'); return; @@ -127,10 +128,16 @@ angular.module('flashy.FeedController', ['ui.router', 'ngAnimate']). console.log('updating'); card.score = new_score; console.log(card); + column = $scope.cardCols[card.colNum]; + var found = column.indexOf(card); + var i = 0; + for (; i < column.length; i++) + if (column[i].score < card.score) break; + column.splice(i, 0, column.splice(found, 1)[0]); - col = $scope.hide(card) + /*var col = $scope.hide(card) if (col != -1) { - $scope.sortAdd(card, $scope.cardCols[col]); + //scope.sortAdd(card, $scope.cardCols[col]); }*/ }; diff --git a/scripts/FlashcardDirective.js b/scripts/FlashcardDirective.js index 57b35e7..cc91a80 100644 --- a/scripts/FlashcardDirective.js +++ b/scripts/FlashcardDirective.js @@ -12,7 +12,6 @@ angular.module('flashy.FlashcardDirective', []). link: function(scope, element) { /* Handles width of the card */ scope.textPieces = []; - scope.flashcard.mask.sort(function(a, b) { return a[0] - b[0]; }); diff --git a/templates/flashcard.html b/templates/flashcard.html index 3d46cee..1c06fe9 100644 --- a/templates/flashcard.html +++ b/templates/flashcard.html @@ -29,7 +29,7 @@
-
+
score:{{flashcard.score}}