Skip to content

Commit b4e795f

Browse files
authored
Merge pull request #2771 from TechnologyEnhancedLearning/Develop/Features/TD-4469CourseReportDetail
TD-4469 Merging into correct branch
2 parents b2a9745 + 1856174 commit b4e795f

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

DigitalLearningSolutions.Data/DataServices/ActivityDataService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ public int GetActivityDetailRowCount(
102102
{
103103
return connection.QuerySingleOrDefault<int>(
104104
@"SELECT COUNT(1) FROM
105-
tActivityLog AS al
105+
tActivityLog AS al INNER JOIN DelegateAccounts AS da ON al.CandidateID = da.ID
106106
WHERE(al.LogDate >= @startDate) AND(@endDate IS NULL OR
107-
al.LogDate <= @endDate) AND(al.CentreID = @centreId) AND(@jobGroupId IS NULL OR
107+
al.LogDate <= @endDate) AND(al.CentreID = @centreId) AND (da.CentreID = @centreId) AND (@jobGroupId IS NULL OR
108108
al.JobGroupID = @jobGroupId) AND(@customisationId IS NULL OR
109109
al.CustomisationID = @customisationId) AND(@courseCategoryId IS NULL OR
110110
al.CourseCategoryID = @courseCategoryId) AND(al.Registered = 1 OR
@@ -160,7 +160,7 @@ Users AS u INNER JOIN
160160
DelegateAccounts AS da ON u.ID = da.UserID ON al.CandidateID = da.ID INNER JOIN
161161
Customisations AS c ON al.CustomisationID = c.CustomisationID
162162
WHERE (al.LogDate >= @startDate) AND (@endDate IS NULL OR
163-
al.LogDate <= @endDate) AND (al.CentreID = @centreId) AND (@jobGroupId IS NULL OR
163+
al.LogDate <= @endDate) AND (al.CentreID = @centreId) AND (da.CentreID = @centreId) AND (@jobGroupId IS NULL OR
164164
al.JobGroupID = @jobGroupId) AND (@customisationId IS NULL OR
165165
al.CustomisationID = @customisationId) AND (@courseCategoryId IS NULL OR
166166
al.CourseCategoryID = @courseCategoryId) AND (al.Registered = 1 OR
Binary file not shown.

DigitalLearningSolutions.Web/Services/ActivityService.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ private void AddActivityDetailSheet(XLWorkbook workbook, int centreId, ActivityF
227227
{
228228
var itemsPerPage = Data.Extensions.ConfigurationExtensions.GetExportQueryRowLimit(configuration);
229229
var resultCount = GetActivityDetailRowCount(centreId, filterData);
230+
if (resultCount == 0)
231+
{
232+
return;
233+
}
230234
int totalRun = (int)(resultCount / itemsPerPage) + ((resultCount % itemsPerPage) > 0 ? 1 : 0);
231235
int currentRun = 1;
232236
List<ActivityLogDetail> activityLogDetails = new List<ActivityLogDetail>();

0 commit comments

Comments
 (0)