diff --git a/inc/myco_objects.js b/inc/myco_objects.js index 39994a4..4b6fcf3 100644 --- a/inc/myco_objects.js +++ b/inc/myco_objects.js @@ -337,6 +337,36 @@ function Group(uuid,name,data) { }; } + this.getContributionsByCategory=function (category) { + var ret={}; + for (uuid in this.contributions) { + if (this.contributions[uuid].category==category.uuid) { + ret[uuid]=this.contributions[uuid]; + } + } + return ret; + } + + this.findUnusedCategories=function() { + var cats={}; + for (uuid in this.contributions) { + cid=this.contributions[uuid].category; + if ($.type(cats[cid])=='undefined') { + cats[cid]=1; + } + else { + cats[cid]++; + } + } + var ret={}; + for (cid in this.categories) { + if ($.type(cats[cid])=='undefined') { + ret[cid]=this.categories[cid]; + } + } + return ret; + } + /* * Categories */