Skip to content

Commit b0defdf

Browse files
authored
Merge pull request #2439 from TechnologyEnhancedLearning/Develop/fix/TD-3313-Issue-with-Delegates-count
TD-3313- Issue with 'Delegates' count showing as '0' on 'Delegates Groups' screen for the listed groups
2 parents e55d9e3 + a43004c commit b0defdf

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

DigitalLearningSolutions.Data/DataServices/GroupsDataService.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -165,17 +165,14 @@ AND NOT EXISTS (SELECT * FROM GroupCustomisations AS GCInner
165165
GroupID,
166166
GroupLabel,
167167
GroupDescription,
168-
(SELECT COUNT(*) FROM ( SELECT
169-
da.CentreID,
170-
COALESCE(ucd.Email, u.PrimaryEmail) AS EmailAddress,
171-
u.JobGroupId
172-
FROM DelegateAccounts AS da WITH (NOLOCK)
173-
INNER JOIN Centres AS c WITH (NOLOCK) ON c.CentreID = da.CentreID
174-
INNER JOIN Users AS u WITH (NOLOCK) ON u.ID = da.UserID
175-
LEFT JOIN UserCentreDetails AS ucd WITH (NOLOCK) ON ucd.UserID = da.UserID AND ucd.CentreID = da.CentreID
176-
INNER JOIN JobGroups AS jg WITH (NOLOCK) ON jg.JobGroupID = u.JobGroupID where c.CentreID = @centreId
177-
AND u.JobGroupID = (select JobGroupID from JobGroups where JobGroupName = GroupLabel)) D Where
178-
EmailAddress LIKE '%_@_%.__%') AS DelegateCount,
168+
(SELECT COUNT(*)
169+
FROM GroupDelegates AS gd WITH (NOLOCK)
170+
JOIN DelegateAccounts AS da WITH (NOLOCK) ON da.ID = gd.DelegateID
171+
JOIN Users AS u WITH (NOLOCK) ON u.ID = da.UserID
172+
LEFT JOIN UserCentreDetails AS ucd WITH (NOLOCK) ON ucd.UserID = u.ID AND ucd.CentreID = da.CentreID
173+
WHERE gd.GroupID = g.GroupID
174+
AND (u.PrimaryEmail like '%_@_%.__%' OR ucd.Email is NOT NULL)
175+
AND da.Approved = 1 AND da.Active = 1) AS DelegateCount,
179176
({CourseCountSql}) AS CoursesCount,
180177
g.CreatedByAdminUserID AS AddedByAdminId,
181178
au.Forename AS AddedByFirstName,
@@ -320,7 +317,9 @@ FROM GroupDelegates AS gd
320317
JOIN DelegateAccounts AS da ON da.ID = gd.DelegateID
321318
JOIN Users AS u ON u.ID = da.UserID
322319
LEFT JOIN UserCentreDetails AS ucd ON ucd.UserID = u.ID AND ucd.CentreID = da.CentreID
323-
WHERE gd.GroupID = @groupId",
320+
WHERE gd.GroupID = @groupId
321+
AND (u.PrimaryEmail like '%_@_%.__%' OR ucd.Email is NOT NULL)
322+
AND da.Approved = 1 AND da.Active = 1",
324323
new { groupId }
325324
);
326325
}

DigitalLearningSolutions.Data/DataServices/UserDataService/DelegateUserCardDataService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ public List<DelegateUserCard> GetDelegatesNotRegisteredForGroupByGroupId(int gro
347347
WHERE da.CentreId = @centreId
348348
AND da.Approved = 1
349349
AND da.Active = 1
350+
AND (u.PrimaryEmail like '%_@_%.__%' OR ucd.Email IS NOT NULL)
350351
AND NOT EXISTS (SELECT DelegateID FROM GroupDelegates WHERE DelegateID = da.ID
351352
AND GroupID = @groupId)",
352353
new

DigitalLearningSolutions.Web/Services/GroupsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ public IEnumerable<GroupDelegateAdmin> GetAdminsForCentreGroups(int? centreId =
524524

525525
public IEnumerable<GroupDelegate> GetGroupDelegates(int groupId)
526526
{
527-
return groupsDataService.GetGroupDelegates(groupId).Where(gd => gd.CentreEmail != null || !Guid.TryParse(gd.PrimaryEmail, out _));
527+
return groupsDataService.GetGroupDelegates(groupId);
528528
}
529529

530530
public IEnumerable<GroupCourse> GetUsableGroupCoursesForCentre(int groupId, int centreId)

0 commit comments

Comments
 (0)