Add getContributionsByCategory() and findUnusedCategories() method to group object
This commit is contained in:
parent
727b1e5d6f
commit
ddaa11ec4f
1 changed files with 30 additions and 0 deletions
|
@ -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
|
* Categories
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue