--- a/cms/app-client/app/components/sorting-component.js Fri Dec 09 11:41:15 2016 +0100
+++ b/cms/app-client/app/components/sorting-component.js Mon Dec 12 17:37:54 2016 +0100
@@ -9,8 +9,8 @@
isAlphabetical: true,
isPopularity: Ember.computed('isAlphabetical', function() { return !this.get('isAlphabetical'); }),
- minimum: Ember.computed('themes', function() { return Math.min(...this.themes.mapBy('count')); }),
- maximum: Ember.computed('themes', function() { return Math.max(...this.themes.mapBy('count')); }),
+ minimum: Ember.computed('themes.[]', function() { return Math.min(...this.get('themes').mapBy('count')); }),
+ maximum: Ember.computed('themes.[]', function() { return Math.max(...this.get('themes').mapBy('count')); }),
more: true,
--- a/cms/app-client/app/helpers/popularity.js Fri Dec 09 11:41:15 2016 +0100
+++ b/cms/app-client/app/helpers/popularity.js Mon Dec 12 17:37:54 2016 +0100
@@ -2,12 +2,9 @@
export function popularity([target, minimum, maximum]) {
var classname = ['not-popular', 'popular', 'very-popular'];
- var interval = ( maximum - minimum ) / classname.length;
+ var interval = ( maximum + 1 - minimum ) / classname.length;
- var i = 0;
- while( target > minimum + ( interval * ( i + 1 ) ) ) {
- i ++;
- }
+ var i = Math.floor((target-minimum)/interval);
return classname[i];
}