]> git.uio.no Git - u/erikhf/frm.git/blobdiff - src/components/search/livesearch.ts
Fixed bugs where searchresult did not update, where searchlist got duplicated when...
[u/erikhf/frm.git] / src / components / search / livesearch.ts
index 60c364f799fa0bdf9c1d3e7dddbca2771c5d6165..390a9035d8900e4dacff4773adb58d98eadd79ff 100644 (file)
@@ -46,58 +46,5 @@ export class LiveSearch {
                 }
             )
     }
-
-    filterUnits(orgunits) {
-        var filteredOrgunits: Array<any> = [];
-        for (var i = 0; i < orgunits.length; i++) {
-            this.http.get(orgunits[i].href)
-                .map(res => res.json())
-                .subscribe(
-                    zone.bind(orgunits => {
-                        if (ownershipSelector.value == "" && typeSelector.value == "" && locationSelector.value == "") {
-                            filteredOrgunits.push(orgunits);
-                        }
-                        else {
-                            var os = false;
-                            var ls = false;
-                            var ts = false;
-                            for (var group in orgunits.organisationUnitGroups) {
-                                if (ownershipSelector.value != "") {
-                                    if (orgunits.organisationUnitGroups[group].name == ownershipSelector.value) {
-                                        os = true;
-                                    }
-                                }
-                                if (ownershipSelector.value == "") {
-                                    os = true;
-                                }
-                                if (typeSelector.value != "") {
-                                    if (orgunits.organisationUnitGroups[group].name == typeSelector.value) {
-                                        ts = true;
-                                    }
-                                }
-                                if (typeSelector.value == "") {
-                                    ts = true;
-                                }
-                                if (locationSelector.value != "") {
-                                    if (orgunits.organisationUnitGroups[group].name == locationSelector.value) {
-                                        ls = true;
-                                    }
-                                }
-                                if (locationSelector.value == "") {
-                                    ls = true;
-                                }
-                                if (os == true && ts == true && ls == true) {
-                                    filteredOrgunits.push(orgunits);
-                                    os = false;
-                                    ts = false;
-                                    ls = false;
-                                }
-                            }
-                        }
-                    })
-                )
-        }
-        return filteredOrgunits;
-    }
 }