From: Bill Erickson Date: Fri, 30 Oct 2015 01:41:34 +0000 (-0400) Subject: LP#1452950 survey dates/sorting; stat cat sorting X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5ad63ee9e7c6490cc6600b5a1f1e32e373694518;p=evergreen%2Fmasslnc.git LP#1452950 survey dates/sorting; stat cat sorting Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js index 443c84c60a..298d8cc3e3 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js @@ -33,11 +33,14 @@ angular.module('egCoreMod') }; service.get_surveys = function() { - var org_ids = egCore.org.ancestors(egCore.auth.user().ws_ou(), true); - - return egCore.pcrud.search('asv', - {owner : org_ids}, - { flesh : 2, + var org_ids = egCore.org.fullPath(egCore.auth.user().ws_ou(), true); + + return egCore.pcrud.search('asv', { + owner : org_ids, + start_date : {'<=' : 'now'}, + end_date : {'>=' : 'now'} + }, { + flesh : 2, flesh_fields : { asv : ['questions'], asvq : ['answers'] @@ -45,6 +48,8 @@ angular.module('egCoreMod') }, {atomic : true} ).then(function(surveys) { + surveys = surveys.sort(function(a,b) { + return a.name() < b.name() ? -1 : 1 }); service.surveys = surveys; angular.forEach(surveys, function(survey) { angular.forEach(survey.questions(), function(question) { @@ -63,6 +68,15 @@ angular.module('egCoreMod') 'open-ils.circ.stat_cat.actor.retrieve.all', egCore.auth.token(), egCore.auth.user().ws_ou() ).then(function(cats) { + cats = cats.sort(function(a, b) { + return a.name() < b.name() ? -1 : 1}); + angular.forEach(cats, function(cat) { + cat.entries( + cat.entries().sort(function(a,b) { + return a.value() < b.value() ? -1 : 1 + }) + ); + }); service.stat_cats = cats; }); };