Commit 4f1bc5f5b935a9415a676fd1e2af51cd1524f1a3

Authored by Tetranoir
1 parent fcda9ffd20

flashcard debug mode togglable with rootscope.debug_flashcard

Showing 3 changed files with 12 additions and 6 deletions Side-by-side Diff

scripts/FeedController.js View file @ 4f1bc5f
... ... @@ -8,6 +8,7 @@
8 8 return $state.go('addclass');
9 9 }
10 10 $rootScope.currentSection = $rootScope.SectionResource.get({sectionId: sectionId});
  11 + $rootScope.debug_flashcard = false;
11 12 $scope.cards = false;
12 13 $scope.cardCols = []; // organized data
13 14 $scope.numCols = 0;
... ... @@ -118,8 +119,8 @@
118 119 return -1;
119 120 };
120 121  
121   - $scope.update = function(id, new_score) { // NOT WORKING
122   - /*card = $scope.cardTable[id].obj;
  122 + $scope.update = function(id, new_score) {
  123 + card = $scope.cardTable[id].obj;
123 124 if (new_score == card.score) {
124 125 console.log('score same, no update required');
125 126 return;
126 127  
127 128  
... ... @@ -127,10 +128,16 @@
127 128 console.log('updating');
128 129 card.score = new_score;
129 130 console.log(card);
  131 + column = $scope.cardCols[card.colNum];
  132 + var found = column.indexOf(card);
  133 + var i = 0;
  134 + for (; i < column.length; i++)
  135 + if (column[i].score < card.score) break;
  136 + column.splice(i, 0, column.splice(found, 1)[0]);
130 137  
131   - col = $scope.hide(card)
  138 + /*var col = $scope.hide(card)
132 139 if (col != -1) {
133   - $scope.sortAdd(card, $scope.cardCols[col]);
  140 + //scope.sortAdd(card, $scope.cardCols[col]);
134 141 }*/
135 142 };
136 143  
scripts/FlashcardDirective.js View file @ 4f1bc5f
... ... @@ -12,7 +12,6 @@
12 12 link: function(scope, element) {
13 13 /* Handles width of the card */
14 14 scope.textPieces = [];
15   -
16 15 scope.flashcard.mask.sort(function(a, b) {
17 16 return a[0] - b[0];
18 17 });
templates/flashcard.html View file @ 4f1bc5f
... ... @@ -29,7 +29,7 @@
29 29 <div ng-show="flashcard.is_in_deck" class="green-text" style="position:absolute; top:0px;right:0px">
30 30 <div class="center-me"><i class="mdi-action-done small"></i></div>
31 31 </div>
32   - <div style="position:absolute; bottom:0px; right:5px">
  32 + <div ng-show="$root.debug_flashcard" style="position:absolute; bottom:0px; right:5px;">
33 33 <span class="center-me">score:{{flashcard.score}}</span>
34 34 </div>
35 35 </div>