@@ -64,10 +64,10 @@ public IEnumerable<ActivityLog> GetFilteredActivity(
6464 SUM(CAST(Registered AS Int)) AS Registered,
6565 SUM(CAST(Completed AS Int)) AS Completed,
6666 SUM(CAST(Evaluated AS Int)) AS Evaluated
67- FROM tActivityLog AS al
67+ FROM tActivityLog AS al INNER JOIN DelegateAccounts AS da ON al.CandidateID = da.ID AND al.CentreID = da.CentreID
6868 WHERE (LogDate >= @startDate
6969 AND (@endDate IS NULL OR LogDate <= @endDate)
70- AND CentreID = @centreId
70+ AND (al. CentreID = @centreId)
7171 AND (@jobGroupId IS NULL OR JobGroupID = @jobGroupId)
7272 AND (@customisationId IS NULL OR al.CustomisationID = @customisationId)
7373 AND (@courseCategoryId IS NULL OR al.CourseCategoryId = @courseCategoryId)
@@ -102,9 +102,9 @@ public int GetActivityDetailRowCount(
102102 {
103103 return connection . QuerySingleOrDefault < int > (
104104 @"SELECT COUNT(1) FROM
105- tActivityLog AS al INNER JOIN DelegateAccounts AS da ON al.CandidateID = da.ID
105+ tActivityLog AS al INNER JOIN DelegateAccounts AS da ON al.CandidateID = da.ID AND al.CentreID = da.CentreID
106106 WHERE(al.LogDate >= @startDate) AND(@endDate IS NULL OR
107- al.LogDate <= @endDate) AND(al.CentreID = @centreId) AND (da.CentreID = @centreId) AND ( @jobGroupId IS NULL OR
107+ al.LogDate <= @endDate) AND(al.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
@@ -157,10 +157,10 @@ int currentRun
157157 FROM Applications AS a INNER JOIN
158158 tActivityLog AS al ON a.ApplicationID = al.ApplicationID INNER JOIN
159159 Users AS u INNER JOIN
160- DelegateAccounts AS da ON u.ID = da.UserID ON al.CandidateID = da.ID INNER JOIN
160+ DelegateAccounts AS da ON u.ID = da.UserID ON al.CandidateID = da.ID AND al.CentreID = da.CentreID 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 (da.CentreID = @centreId) AND ( @jobGroupId IS NULL OR
163+ al.LogDate <= @endDate) AND (al.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
0 commit comments