Skip to content

Commit

Permalink
v1.6.37 - RollupCalcItemReplacer bugfix (#635)
Browse files Browse the repository at this point in the history
* Fixes error reported interally with polymorphic where clause replacements being mutually exclusive with the current list of items
  • Loading branch information
jamessimone authored Oct 29, 2024
1 parent 2ea75e8 commit 9e89a1e
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ As well, don't miss [the Wiki](../../wiki), which includes even more info for co

## Deployment & Setup

<a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008OfMeAAK">
<a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008OfSEAA0">
<img alt="Deploy to Salesforce"
src="./media/deploy-package-to-prod.png">
</a>

<a href="https://test.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008OfMeAAK">
<a href="https://test.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008OfSEAA0">
<img alt="Deploy to Salesforce Sandbox"
src="./media/deploy-package-to-sandbox.png">
</a>
Expand Down
18 changes: 18 additions & 0 deletions extra-tests/classes/RollupCalcItemReplacerTests.cls
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,22 @@ private class RollupCalcItemReplacerTests {

System.assertEquals(ACC_ANNUAL_REVENUE, acc.AnnualRevenue);
}

@IsTest
static void exclusiveWhereClauseWithMultipleMetadataRecordsDoesNotBlowUpList() {
Account acc = [SELECT Id FROM Account];
RollupCalcItemReplacer replacer = new RollupCalcItemReplacer(
new RollupControl__mdt(IsRollupLoggingEnabled__c = true, ReplaceCalcItemsAsyncWhenOverCount__c = 3)
);

List<SObject> records = replacer.replace(
new List<Account>{ acc, acc },
new List<Rollup__mdt>{
new Rollup__mdt(CalcItemWhereClause__c = 'Id != \'' + acc.Id + '\' AND Owner.Name = null', CalcItem__c = 'Account'),
new Rollup__mdt(CalcItemWhereClause__c = 'AnnualRevenue = null', CalcItem__c = 'Account')
}
);

Assert.areEqual(0, records.size());
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apex-rollup",
"version": "1.6.36",
"version": "1.6.37",
"description": "Fast, configurable, elastically scaling custom rollup solution. Apex Invocable action, one-liner Apex trigger/CMDT-driven logic, and scheduled Apex-ready.",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions rollup-namespaced/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ For more info, see the base `README`.

## Deployment & Setup

<a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008OfMjAAK">
<a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008OfSJAA0">
<img alt="Deploy to Salesforce"
src="./media/deploy-package-to-prod.png">
</a>

<a href="https://test.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008OfMjAAK">
<a href="https://test.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008OfSJAA0">
<img alt="Deploy to Salesforce Sandbox"
src="./media/deploy-package-to-sandbox.png">
</a>
9 changes: 5 additions & 4 deletions rollup-namespaced/sfdx-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"default": true,
"package": "apex-rollup-namespaced",
"path": "rollup-namespaced/source/rollup",
"versionName": "Fixes Rollup Order By issue when called from RollupFlowBulkProcessor",
"versionNumber": "1.1.29.0",
"versionName": "Fixes mutually exclusive polymorphic where clauses replacing children in RollupCalcItemReplacer",
"versionNumber": "1.1.30.0",
"versionDescription": "Fast, configurable, elastically scaling custom rollup solution. Apex Invocable action, one-liner Apex trigger/CMDT-driven logic, and scheduled Apex-ready.",
"releaseNotesUrl": "https://github.com/jamessimone/apex-rollup/releases/latest",
"unpackagedMetadata": {
Expand All @@ -32,6 +32,7 @@
"apex-rollup-namespaced@1.1.26": "04t6g000008ObeVAAS",
"apex-rollup-namespaced@1.1.27": "04t6g000008OfJkAAK",
"apex-rollup-namespaced@1.1.28": "04t6g000008OfKnAAK",
"apex-rollup-namespaced@1.1.29": "04t6g000008OfMjAAK"
"apex-rollup-namespaced@1.1.29": "04t6g000008OfMjAAK",
"apex-rollup-namespaced@1.1.30": "04t6g000008OfSJAA0"
}
}
}
3 changes: 3 additions & 0 deletions rollup/core/classes/RollupCalcItemReplacer.cls
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ public without sharing class RollupCalcItemReplacer {
Map<String, Schema.SObjectField> fieldMap = calcItems[0].getSObjectType().getDescribe(SObjectDescribeOptions.DEFERRED).fields.getMap();
for (Rollup__mdt meta : this.metaToEval.keySet()) {
calcItems = this.replaceCalcItemsWithPolymorphicWhereClauses(calcItems, meta, fieldMap);
if (calcItems.isEmpty()) {
break;
}
}
}
return calcItems;
Expand Down
2 changes: 1 addition & 1 deletion rollup/core/classes/RollupDateLiteral.cls
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ public without sharing abstract class RollupDateLiteral {
private class NextWeekLiteral extends RollupDateLiteral {
public NextWeekLiteral() {
this.ref = getRelativeDatetime(System.today().toStartOfWeek().addDays(7), START_TIME);
this.bound = getRelativeDatetime(this.ref.addDays(6).date(), END_TIME);
this.bound = getRelativeDatetime(this.ref.addDays(6).dateGmt(), END_TIME);
}
}

Expand Down
2 changes: 1 addition & 1 deletion rollup/core/classes/RollupLogger.cls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
global without sharing virtual class RollupLogger implements ILogger {
@TestVisible
// this gets updated via the pipeline as the version number gets incremented
private static final String CURRENT_VERSION_NUMBER = 'v1.6.36';
private static final String CURRENT_VERSION_NUMBER = 'v1.6.37';
private static final System.LoggingLevel FALLBACK_LOGGING_LEVEL = System.LoggingLevel.DEBUG;
private static final RollupPlugin PLUGIN = new RollupPlugin();

Expand Down
7 changes: 4 additions & 3 deletions sfdx-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"package": "apex-rollup",
"path": "rollup",
"scopeProfiles": true,
"versionName": "Fixes Rollup Order By issue when called from RollupFlowBulkProcessor",
"versionNumber": "1.6.36.0",
"versionName": "Fixes mutually exclusive polymorphic where clauses replacing children in RollupCalcItemReplacer",
"versionNumber": "1.6.37.0",
"versionDescription": "Fast, configurable, elastically scaling custom rollup solution. Apex Invocable action, one-liner Apex trigger/CMDT-driven logic, and scheduled Apex-ready.",
"releaseNotesUrl": "https://github.com/jamessimone/apex-rollup/releases/latest",
"unpackagedMetadata": {
Expand Down Expand Up @@ -106,6 +106,7 @@
"apex-rollup@1.6.33": "04t6g000008ObeQAAS",
"apex-rollup@1.6.34": "04t6g000008OfJfAAK",
"apex-rollup@1.6.35": "04t6g000008OfKiAAK",
"apex-rollup@1.6.36": "04t6g000008OfMeAAK"
"apex-rollup@1.6.36": "04t6g000008OfMeAAK",
"apex-rollup@1.6.37": "04t6g000008OfSEAA0"
}
}

0 comments on commit 9e89a1e

Please sign in to comment.