reciprocity/ggrc-core — pull request #1718 by Smotko (2014-08-28 16:10:24+00:00)
Title: Support for extra columns in count query

This commit adds support for multiple filter types. It's still need needs, but I'm opening the PR to create a discussion about it.

The changes make this query:

GGRC.Models.Search.findOne({
q : '',
counts_only:true,
extra_columns: "Workflow_All=Workflow,Workflow_Active=Workflow,Workflow_Draft=Workflow,Workflow_Inactive=Workflow",
extra_params: 'Workflow:status=Active;Workflow_Active:status=Active;Workflow_Draft:status=Draft;Workflow_Inactive:status=Inactive'
}).then(function(){console.log(arguments[0].counts)});

Return:

{
Audit: 237
...
Workflow: 18
Workflow_Active: 18
Workflow_All: 84
Workflow_Draft: 40
Workflow_Inactive: 26
}

Which is what we need to make filters display counts.