- }
-
- map<string,double>::iterator pos;
- for(pos=unique.begin();pos!=unique.end();pos++){
- if((pos->first!="xxx") && (inUsersGroups(pos->first))){
- UW += unique[pos->first];
+
+ /**********************************************************************/
+ //This section adds in all lengths that are leaf
+
+ //if i's chidren are leaves
+ if (t->tree[rc].getRChild() == -1) {
+ //if rc is a valid group and rc has a BL
+ if ((inUsersGroups(t->tree[rc].getGroup(), globaldata->Groups) == true) && (t->tree[rc].getBranchLength() != -1)) {
+ UniqueBL += t->tree[rc].getBranchLength();
+ totalBL += t->tree[rc].getBranchLength();
+ }
+ }
+
+ if (t->tree[lc].getLChild() == -1) {
+ //if lc is a valid group and lc has a BL
+ if ((inUsersGroups(t->tree[lc].getGroup(), globaldata->Groups) == true) && (t->tree[lc].getBranchLength() != -1)) {
+ UniqueBL += t->tree[lc].getBranchLength();
+ totalBL += t->tree[lc].getBranchLength();
+ }