diff --git a/DigitalLearningSolutions.Data/DataServices/CourseDataService.cs b/DigitalLearningSolutions.Data/DataServices/CourseDataService.cs index 16e7b22de3..cb90cc0c73 100644 --- a/DigitalLearningSolutions.Data/DataServices/CourseDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/CourseDataService.cs @@ -153,7 +153,7 @@ LEFT JOIN UserCentreDetails AS ucd WITH (NOLOCK) ON ucd.UserID = da.UserID AND u WHERE pr.CustomisationID = cu.CustomisationID AND can.CentreID = @centreId AND RemovedDate IS NULL - AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%.__%') AS DelegateCount"; + AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%') AS DelegateCount"; private const string CompletedCountQuery = @"(SELECT COUNT(pr.CandidateID) @@ -164,7 +164,7 @@ INNER JOIN dbo.Users AS u WITH (NOLOCK) ON u.ID = da.UserID LEFT JOIN UserCentreDetails AS ucd WITH (NOLOCK) ON ucd.UserID = da.UserID AND ucd.centreID = da.centreID WHERE pr.CustomisationID = cu.CustomisationID AND pr.Completed IS NOT NULL AND can.CentreID = @centreId - AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%.__%') AS CompletedCount"; + AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%') AS CompletedCount"; private const string AllAttemptsQuery = @"(SELECT COUNT(aa.AssessAttemptID) @@ -1123,7 +1123,7 @@ AND ap.DefaultContentTypeID <> 4 AND ((@answer3 IS NULL) OR ((@answer3 = 'No option selected' OR @answer3 = 'FREETEXTBLANKVALUE') AND (pr.Answer3 IS NULL OR LTRIM(RTRIM(pr.Answer3)) = '')) OR ((@answer3 = 'FREETEXTNOTBLANKVALUE' AND pr.Answer3 IS NOT NULL AND LTRIM(RTRIM(pr.Answer3)) != '') OR (pr.Answer3 IS NOT NULL AND pr.Answer3 = @answer3))) - AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%.__%'"; + AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%'"; string orderBy; string sortOrder; @@ -1631,7 +1631,7 @@ FROM DelegateAccounts AS da WHERE da.CentreID = @centreId AND p.CustomisationID = @customisationId AND ap.DefaultContentTypeID <> 4 - AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%.__%'", + AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%'", new { customisationId, centreId } ); } @@ -1677,7 +1677,7 @@ AND ap.DefaultContentTypeID <> 4 AND ((@answer3 IS NULL) OR ((@answer3 = 'No option selected' OR @answer3 = 'FREETEXTBLANKVALUE') AND (pr.Answer3 IS NULL OR LTRIM(RTRIM(pr.Answer3)) = '')) OR ((@answer3 = 'FREETEXTNOTBLANKVALUE' AND pr.Answer3 IS NOT NULL AND LTRIM(RTRIM(pr.Answer3)) != '') OR (pr.Answer3 IS NOT NULL AND pr.Answer3 = @answer3))) - AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%.__%'"; + AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%'"; var mainSql = "SELECT COUNT(*) AS TotalRecords " + fromTableQuery; @@ -1778,7 +1778,7 @@ AND ap.DefaultContentTypeID <> 4 AND ((@answer3 IS NULL) OR ((@answer3 = 'No option selected' OR @answer3 = 'FREETEXTBLANKVALUE') AND (pr.Answer3 IS NULL OR LTRIM(RTRIM(pr.Answer3)) = '')) OR ((@answer3 = 'FREETEXTNOTBLANKVALUE' AND pr.Answer3 IS NOT NULL AND LTRIM(RTRIM(pr.Answer3)) != '') OR (pr.Answer3 IS NOT NULL AND pr.Answer3 = @answer3))) - AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%.__%'"; + AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%'"; string orderBy; string sortOrder; @@ -1963,7 +1963,7 @@ FROM dbo.CandidateAssessments AS can WITH (NOLOCK) INNER JOIN Users AS u WITH (NOLOCK) ON u.ID = can.DelegateUserID LEFT JOIN UserCentreDetails AS ucd WITH (NOLOCK) ON ucd.UserID = u.ID AND ucd.centreID = can.CentreID WHERE can.CentreID = @centreId AND can.SelfAssessmentID = csa.SelfAssessmentID - AND can.RemovedDate IS NULL AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%.__%') AS DelegateCount, + AND can.RemovedDate IS NULL AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%') AS DelegateCount, (Select COUNT(*) FROM (SELECT can.ID FROM dbo.CandidateAssessments AS can WITH (NOLOCK) LEFT JOIN dbo.CandidateAssessmentSupervisors AS cas ON can.ID = cas.CandidateAssessmentID @@ -2017,7 +2017,7 @@ FROM Customisations WHERE CustomisationID = @customisationID ", new { customisationId }).FirstOrDefault(); - + } } } diff --git a/DigitalLearningSolutions.Data/DataServices/GroupsDataService.cs b/DigitalLearningSolutions.Data/DataServices/GroupsDataService.cs index 687dc46683..f3fc7e3738 100644 --- a/DigitalLearningSolutions.Data/DataServices/GroupsDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/GroupsDataService.cs @@ -174,7 +174,7 @@ JOIN DelegateAccounts AS da WITH (NOLOCK) ON da.ID = gd.DelegateID JOIN Users AS u WITH (NOLOCK) ON u.ID = da.UserID LEFT JOIN UserCentreDetails AS ucd WITH (NOLOCK) ON ucd.UserID = u.ID AND ucd.CentreID = da.CentreID WHERE gd.GroupID = g.GroupID - AND (u.PrimaryEmail like '%_@_%.__%' OR ucd.Email is NOT NULL) + AND (u.PrimaryEmail like '%_@_%' OR ucd.Email is NOT NULL) AND da.Approved = 1 AND da.Active = 1) AS DelegateCount, ({CourseCountSql}) AS CoursesCount, g.CreatedByAdminUserID AS AddedByAdminId, @@ -213,7 +213,7 @@ public IEnumerable GetGroupsForCentre(int centreId) new { centreId } ); } -public IEnumerable GetGroupsForRegistrationResponse(int centreId, string? answer1, string? answer2, string? answer3, string? jobGroup, string? answer4, string? answer5, string? answer6) + public IEnumerable GetGroupsForRegistrationResponse(int centreId, string? answer1, string? answer2, string? answer3, string? jobGroup, string? answer4, string? answer5, string? answer6) { return connection.Query( @$"{groupsSql} @@ -337,7 +337,7 @@ FROM GroupDelegates AS gd JOIN Users AS u ON u.ID = da.UserID LEFT JOIN UserCentreDetails AS ucd ON ucd.UserID = u.ID AND ucd.CentreID = da.CentreID WHERE gd.GroupID = @groupId - AND (u.PrimaryEmail like '%_@_%.__%' OR ucd.Email is NOT NULL) + AND (u.PrimaryEmail like '%_@_%' OR ucd.Email is NOT NULL) AND da.Approved = 1 AND da.Active = 1", new { groupId } ); diff --git a/DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/SelfAssessmentDataService.cs b/DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/SelfAssessmentDataService.cs index bbe9f09e19..6c8f94e30a 100644 --- a/DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/SelfAssessmentDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/SelfAssessmentDataService.cs @@ -248,7 +248,7 @@ LEFT JOIN dbo.CandidateAssessmentSupervisorVerifications AS casv WITH (NOLOCK) O AND ((@isDelegateActive IS NULL) OR (@isDelegateActive = 1 AND (da.Active = 1)) OR (@isDelegateActive = 0 AND (da.Active = 0))) AND ((@removed IS NULL) OR (@removed = 1 AND (ca.RemovedDate IS NOT NULL)) OR (@removed = 0 AND (ca.RemovedDate IS NULL))) AND ((@submitted IS NULL) OR (@submitted = 1 AND (ca.SubmittedDate IS NOT NULL)) OR (@submitted = 0 AND (ca.SubmittedDate IS NULL))) - AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%.__%' "; + AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%' "; var groupBy = $@" GROUP BY da.CandidateNumber, @@ -383,7 +383,7 @@ LEFT JOIN dbo.CandidateAssessmentSupervisors AS cas WITH (NOLOCK) ON ca.ID = cas var whereQuery = $@" WHERE sa.ID = @selfAssessmentId AND da.CentreID = @centreID AND csa.CentreID = @centreID AND (ca.RemovedDate IS NULL) - AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%.__%' "; + AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%' "; var groupBy = $@" GROUP BY da.CandidateNumber, @@ -473,7 +473,7 @@ LEFT OUTER JOIN AdminAccounts AS aaEnrolledBy WITH (NOLOCK) ON aaEnrolledBy.ID = AND ((@isDelegateActive IS NULL) OR (@isDelegateActive = 1 AND (da.Active = 1)) OR (@isDelegateActive = 0 AND (da.Active = 0))) AND ((@removed IS NULL) OR (@removed = 1 AND (ca.RemovedDate IS NOT NULL)) OR (@removed = 0 AND (ca.RemovedDate IS NULL))) AND ((@submitted IS NULL) OR (@submitted = 1 AND (ca.SubmittedDate IS NOT NULL)) OR (@submitted = 0 AND (ca.SubmittedDate IS NULL))) - AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%.__%' "; + AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%' "; var groupBy = $@" GROUP BY da.CandidateNumber, @@ -577,7 +577,7 @@ LEFT OUTER JOIN AdminAccounts AS aaEnrolledBy WITH (NOLOCK) ON aaEnrolledBy.ID = AND ((@isDelegateActive IS NULL) OR (@isDelegateActive = 1 AND (da.Active = 1)) OR (@isDelegateActive = 0 AND (da.Active = 0))) AND ((@removed IS NULL) OR (@removed = 1 AND (ca.RemovedDate IS NOT NULL)) OR (@removed = 0 AND (ca.RemovedDate IS NULL))) AND ((@submitted IS NULL) OR (@submitted = 1 AND (ca.SubmittedDate IS NOT NULL)) OR (@submitted = 0 AND (ca.SubmittedDate IS NULL))) - AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%.__%' "; + AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%' "; var groupBy = $@" GROUP BY da.CandidateNumber, diff --git a/DigitalLearningSolutions.Data/DataServices/UserDataService/DelegateUserCardDataService.cs b/DigitalLearningSolutions.Data/DataServices/UserDataService/DelegateUserCardDataService.cs index 5576a5adae..8e2a424ed5 100644 --- a/DigitalLearningSolutions.Data/DataServices/UserDataService/DelegateUserCardDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/UserDataService/DelegateUserCardDataService.cs @@ -187,7 +187,7 @@ LEFT JOIN UserCentreDetails AS ucd WITH (NOLOCK) ON ucd.UserID = da.UserID AND u AND Approved = 1 - AND EmailAddress LIKE '%_@_%.__%'"; + AND EmailAddress LIKE '%_@_%'"; public DelegateUserCard? GetDelegateUserCardById(int id) { var user = connection.Query( @@ -224,7 +224,7 @@ public int GetCountDelegateUserCardsForExportByCentreId(String searchString, str { searchString = searchString.Trim(); } - + if (groupId.HasValue) { var groupDelegatesForCentre = $@"SELECT DelegateID FROM GroupDelegates WHERE GroupID in ( @@ -232,7 +232,7 @@ public int GetCountDelegateUserCardsForExportByCentreId(String searchString, str )"; DelegatewhereConditon += "AND D.ID IN ( " + groupDelegatesForCentre + " AND GroupID = @groupId )"; } - + var delegateCountQuery = @$"SELECT COUNT(*) AS Matches FROM ( " + DelegateUserExportSelectQuery + " ) D " + DelegatewhereConditon; @@ -339,7 +339,7 @@ public List GetDelegateUserCardsForExportByCentreId(String sea )"; if (groupId.HasValue) DelegatewhereConditon += "AND D.ID IN ( " + groupDelegatesForCentre + " AND GroupID = @groupId )"; - + string orderBy; @@ -424,7 +424,7 @@ public List GetDelegatesNotRegisteredForGroupByGroupId(int gro WHERE da.CentreId = @centreId AND da.Approved = 1 AND da.Active = 1 - AND (u.PrimaryEmail like '%_@_%.__%' OR ucd.Email IS NOT NULL) + AND (u.PrimaryEmail like '%_@_%' OR ucd.Email IS NOT NULL) AND NOT EXISTS (SELECT DelegateID FROM GroupDelegates WHERE DelegateID = da.ID AND GroupID = @groupId)", new