Generate category limits correctly -- thanks to NE!
[mkws-moved-to-github.git] / src / mkws-team.js
index 8d33d9e..08f67b3 100644 (file)
@@ -185,7 +185,9 @@ function team($, teamName) {
 
     that.limitCategory = function(id) {
        log("limitCategory(id=" + id + ")");
-       m_filterSet.add(categoryFilter(id));
+        // Only one category filter at a time
+       m_filterSet.removeMatching(function(f) { return f.type === 'category' });        
+        if (id !== '') m_filterSet.add(categoryFilter(id));
         if (m_query) triggerSearch();
        return false;
     };
@@ -270,10 +272,12 @@ function team($, teamName) {
        var pp2filter = m_filterSet.pp2filter();
        var pp2limit = m_filterSet.pp2limit(limit);
         var pp2catLimit = m_filterSet.pp2catLimit();
+       if (pp2catLimit) {
+            pp2filter = pp2filter ? pp2filter + "," + pp2catLimit : pp2catLimit;
+        }
 
        var params = {};
        if (pp2limit) params.limit = pp2limit;
-       if (pp2catLimit) params.categoryfilter = pp2catLimit;
        if (maxrecs) params.maxrecs = maxrecs;
        if (torusquery) {
            if (!mkws.config.use_service_proxy)