Skip to content

Commit

Permalink
PRESIDECMS-2941 get savedFiltersList once
Browse files Browse the repository at this point in the history
  • Loading branch information
Pixl8RusselCole committed Nov 25, 2024
1 parent 3649903 commit bc99177
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ component {
return {
filter = filter.filter ?: {}
, filterParams = filter.filterParams ?: {}
, having = filter.having ?: ""
, extraJoins = filter.extraJoins ?: []
};
}

Expand Down
29 changes: 18 additions & 11 deletions system/services/presideObjects/PresideObjectService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,14 @@ component displayName="Preside Object Service" {
}
}

args.savedFilterList = [];

var filterService = _getFilterService();

for( var savedFilter in arguments.savedFilters ){
ArrayAppend( args.savedFilterList, filterService.getFilter( savedFilter ) );
}

args.extraFilters.append( _expandSavedFilters( argumentCollection=args ), true );

if ( args.useCache ) {
Expand Down Expand Up @@ -3384,10 +3392,10 @@ component displayName="Preside Object Service" {

private array function _convertObjectJoinsToTableJoins(
required array joins
, array extraJoins = []
, array extraFilters = []
, array savedFilters = []
, struct preparedFilter = {}
, array extraJoins = []
, array extraFilters = []
, array savedFilterList = []
, struct preparedFilter = {}
) {
var tableJoins = [];
var objJoin = "";
Expand Down Expand Up @@ -3430,8 +3438,9 @@ component displayName="Preside Object Service" {

tableJoins.append( arguments.extraJoins, true );

for( var savedFilter in arguments.savedFilters ){
savedFilter = _getFilterService().getFilter( savedFilter );
for( var savedFilter in arguments.savedFilterList ){

arguments.preparedFilter.params = arguments.preparedFilter.params ?: [];

if ( IsArray( savedFilter.extraJoins ?: "" ) ) {
tableJoins.append( savedFilter.extraJoins, true );
Expand Down Expand Up @@ -3832,13 +3841,11 @@ component displayName="Preside Object Service" {
return _relationshipPathCalcCache[ cacheKey ];
}

private array function _expandSavedFilters( required array savedFilters ) {
private array function _expandSavedFilters( required array savedFilterList ) {
var expanded = [];
var filterService = _getFilterService();

for( var savedFilter in arguments.savedFilters ){
savedFilter = filterService.getFilter( savedFilter );
/*var filterService = _getFilterService();*/

for( var savedFilter in arguments.savedFilterList ){
expanded.append({
filter = savedFilter.filter ?: {}
, filterParams = savedFilter.filterParams ?: {}
Expand Down

0 comments on commit bc99177

Please sign in to comment.