'use strict';

/**
 * @ngdoc filter
 * @name annotationAppApp.filter:sortInsightsByLinkedReviewsDesc
 * @function
 * @description
 * # sortInsightsByLinkedReviewsDesc
 * Filter in the annotationAppApp.
 */
angular.module('app')
	.filter('sortInsightsByLinkedReviewsDesc', function() {
		return function(insights) {
			// console.log('insights', insights)
			if (!insights) {
				return [];
			}
			return insights.sort(function(i1, i2) {
				return (i2.reviewIds.length || 0) - (i1.reviewIds.length || 0);
			});
		};
	});
