Skip to content

Commit

Permalink
Merge pull request #121 from vibhasinghal/master
Browse files Browse the repository at this point in the history
Fixed bug for consumption order preference order - the preferences be…
  • Loading branch information
germanattanasio authored Jan 12, 2017
2 parents b24c8b9 + 59c436b commit 836a09b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions public/js/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,11 @@ $(document).ready(function () {
return accumulator;
}

function sortIdxComparator(a, b) {
function sortIdxComparator(x, y) {

var a = x.idx;
var b = y.idx;

if (a < b) {
return -1;
}
Expand Down Expand Up @@ -736,7 +740,10 @@ $(document).ready(function () {
behaviors.html("");
behaviors.append("<h4 class=\"base--h4\">" + getLikelyToLabel() + "</h4>");
behaviors.append("<div class=\"output-summary--likely-behaviors\">");
likelycps.sort(sortIdxComparator).reduce(addIfAllowedReducer,[]).slice(0,3).map(function(item) {


var likelycps_sorted = likelycps.sort(sortIdxComparator);
likelycps_sorted.reduce(addIfAllowedReducer,[]).slice(0,3).map(function(item) {
behaviors.append("<div class=\"output-summary--behavior output-summary--behavior_POSITIVE\"><i class=\"icon icon-likely\"></i>" + item.name + "</div>\n");
});
behaviors.append("</div>");
Expand Down

0 comments on commit 836a09b

Please sign in to comment.