Skip to content

Commit

Permalink
Issue 280 - CalculateJobId__c not being set
Browse files Browse the repository at this point in the history
#2
80
  • Loading branch information
afawcettffdc committed Mar 20, 2016
1 parent 7b10e80 commit f2b4a5c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rolluptool/src/classes/RollupService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ global with sharing class RollupService
Integer scopeSize = (Integer) DeclarativeLookupRollupSummaries__c.getInstance().CalculateJobScopeSize__c;
Id jobId = Database.executeBatch(new RollupCalculateJob(lookupId, masterWhereClause), scopeSize == null ? 100 : scopeSize);

// Update CalculateJobId__c for Custom Object based rollups?
if(lookup.Record instanceof LookupRollupSummary__c) {
LookupRollupSummary__c rollupSummary = (LookupRollupSummary__c) lookup.Record;
rollupSummary.CalculateJobId__c = jobId;
update lookup.Record;
}

return jobId;
}

Expand Down
3 changes: 3 additions & 0 deletions rolluptool/src/classes/RollupServiceTest3.cls
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ private with sharing class RollupServiceTest3
System.assert(e.getMessage().equals('A calculate job for rollup \'Test Rollup\' is already executing. If you suspect it is not aleady running try clearing the applicable record from the Lookup Rollup Calculate Jobs tab and try again.'));
}
Test.stopTest();
// Assert job id cleared
rollupSummary = [select Id, CalculateJobId__c from LookupRollupSummary__c where Id = :rollupSummary.Id];
System.assertEquals(jobId, rollupSummary.CalculateJobId__c);
// Assert job cleared
System.assertEquals(0, [select Id from LookupRollupCalculateJob__c].size());

Expand Down

0 comments on commit f2b4a5c

Please sign in to comment.