Skip to content

Commit

Permalink
Merge pull request #1834 from akto-api-security/hotfix/test_config_fi…
Browse files Browse the repository at this point in the history
…lters

fix: fixed a filter for test config
  • Loading branch information
notshivansh authored Dec 17, 2024
2 parents 11a254f + 8c03425 commit e37db62
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ public Map<String, TestConfig> fetchTestConfigMap(boolean includeYamlContent, bo
Map<String, TestConfig> testConfigMap = new HashMap<>();
List<Bson> filters = new ArrayList<>();
filters.add(customFilter);
if (fetchOnlyActive) {
filters.add(Filters.exists(YamlTemplate.INACTIVE, false));
filters.add(Filters.eq(YamlTemplate.INACTIVE, false));
if (fetchOnlyActive) {Bson filter = Filters.or(
Filters.exists(YamlTemplate.INACTIVE, false),
Filters.eq(YamlTemplate.INACTIVE, false)
);
filters.add(filter);
} else {
filters.add(new BasicDBObject());
}
Expand All @@ -38,7 +40,7 @@ public Map<String, TestConfig> fetchTestConfigMap(boolean includeYamlContent, bo
int localLimit = Math.min(100, limit);

while (localCounter < limit) {
yamlTemplates = YamlTemplateDao.instance.findAll(Filters.or(filters), localSkip, localLimit, Sorts.ascending("_id"), proj);
yamlTemplates = YamlTemplateDao.instance.findAll(Filters.and(filters), localSkip, localLimit, Sorts.ascending("_id"), proj);
for (YamlTemplate yamlTemplate: yamlTemplates) {
try {
TestConfig testConfig = TestConfigYamlParser.parseTemplate(yamlTemplate.getContent());
Expand Down

0 comments on commit e37db62

Please sign in to comment.