Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions DigitalLearningSolutions.Data/DataServices/CourseDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 }
);
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -2017,7 +2017,7 @@ FROM Customisations
WHERE CustomisationID = @customisationID ",
new { customisationId }).FirstOrDefault();


}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -213,7 +213,7 @@ public IEnumerable<Group> GetGroupsForCentre(int centreId)
new { centreId }
);
}
public IEnumerable<Group> GetGroupsForRegistrationResponse(int centreId, string? answer1, string? answer2, string? answer3, string? jobGroup, string? answer4, string? answer5, string? answer6)
public IEnumerable<Group> GetGroupsForRegistrationResponse(int centreId, string? answer1, string? answer2, string? answer3, string? jobGroup, string? answer4, string? answer5, string? answer6)
{
return connection.Query<Group>(
@$"{groupsSql}
Expand Down Expand Up @@ -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 }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<DelegateUserCard>(
Expand Down Expand Up @@ -224,15 +224,15 @@ public int GetCountDelegateUserCardsForExportByCentreId(String searchString, str
{
searchString = searchString.Trim();
}

if (groupId.HasValue)
{
var groupDelegatesForCentre = $@"SELECT DelegateID FROM GroupDelegates WHERE GroupID in (
SELECT GroupID FROM Groups WHERE CentreID = @centreId AND RemovedDate IS NULL
)";
DelegatewhereConditon += "AND D.ID IN ( " + groupDelegatesForCentre + " AND GroupID = @groupId )";
}


var delegateCountQuery = @$"SELECT COUNT(*) AS Matches FROM ( " + DelegateUserExportSelectQuery + " ) D " + DelegatewhereConditon;

Expand Down Expand Up @@ -339,7 +339,7 @@ public List<DelegateUserCard> GetDelegateUserCardsForExportByCentreId(String sea
)";
if (groupId.HasValue)
DelegatewhereConditon += "AND D.ID IN ( " + groupDelegatesForCentre + " AND GroupID = @groupId )";


string orderBy;

Expand Down Expand Up @@ -424,7 +424,7 @@ public List<DelegateUserCard> 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
Expand Down