Commit 5c6363eb7e06013445383f8525353e25c965b787
Exists in
master
and in
1 other branch
merge
Showing 4 changed files Side-by-side Diff
scripts/FeedController.js
View file @
5c6363e
... | ... | @@ -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; |
... | ... | @@ -42,7 +43,7 @@ |
42 | 43 | for (i = 0; i < $scope.numCols; i++) cols.push([]); |
43 | 44 | $scope.cards.forEach(function(card, i) { |
44 | 45 | cols[i % $scope.numCols].push(card); |
45 | - $scope.cardTable[card.id] = {'colNum': i % $scope.numCols, 'obj': card}; | |
46 | + $scope.cardTable[card.id] = {'colNum': (i % $scope.numCols), 'obj': card}; | |
46 | 47 | }); |
47 | 48 | // wait until the next digest cycle to update cardCols |
48 | 49 | |
49 | 50 | |
50 | 51 | |
51 | 52 | |
52 | 53 | |
... | ... | @@ -116,22 +117,38 @@ |
116 | 117 | console.log('Error finding card to hide:'); |
117 | 118 | console.log(card); |
118 | 119 | return -1; |
119 | - }; | |
120 | + }; << | |
121 | +<< << < HEAD; | |
120 | 122 | |
121 | - $scope.update = function(id, new_score) { // NOT WORKING | |
123 | + $scope.update = function(id, new_score) { === // NOT WORKING | |
122 | 124 | /*card = $scope.cardTable[id].obj; |
123 | 125 | if (new_score == card.score) { |
126 | +======= | |
127 | + | |
128 | + $scope.update = function(id, new_score) { | |
129 | + card = $scope.cardTable[id].obj; | |
130 | + if (Math.abs(new_score - card.score) < .0001) { | |
131 | +>>>>>>> 5d2fe8fd2eba8b425eb41fe6382ff57ae66bb100 | |
124 | 132 | console.log('score same, no update required'); |
125 | 133 | return; |
126 | 134 | } |
127 | 135 | console.log('updating'); |
128 | 136 | card.score = new_score; |
129 | 137 | console.log(card); |
138 | +<<<<<<< HEAD | |
130 | 139 | |
131 | 140 | col = $scope.hide(card) |
132 | 141 | if (col != -1) { |
133 | 142 | $scope.sortAdd(card, $scope.cardCols[col]); |
134 | 143 | }*/ |
144 | +=== = | |
145 | +var column = $scope.cardCols[$scope.cardTable[id].colNum]; | |
146 | + var found = column.indexOf(card); | |
147 | + var i = 0; | |
148 | + for (; i < column.length; i++) | |
149 | + if (column[i].score <= card.score) break; | |
150 | + column.splice(i, 0, column.splice(found, 1)[0]); >>> | |
151 | +>>> > 5d2fe8fd2eba8b425eb41fe6382ff57ae66bb100; | |
135 | 152 | }; |
136 | 153 | |
137 | 154 | var loc = window.location, new_uri; |
scripts/FlashcardDirective.js
View file @
5c6363e
templates/feed.html
View file @
5c6363e
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | <div class="indeterminate"></div> |
6 | 6 | </div> |
7 | 7 | <div class="cardColumn" ng-repeat="col in cardCols"> |
8 | - <div class="repeated-card" ng-repeat="card in col track by $index"> | |
8 | + <div class="repeated-card" ng-repeat="card in col"> | |
9 | 9 | <flashcard flashcard-obj="card" refresh="hide(card)"/> |
10 | 10 | </div> |
11 | 11 | </div> |
templates/flashcard.html
View file @
5c6363e
... | ... | @@ -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> |