Skip to content
Merged
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
24 changes: 16 additions & 8 deletions DigitalLearningSolutions.Data/DataServices/CourseDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,32 @@ public interface ICourseDataService
public class CourseDataService : ICourseDataService
{
private const string DelegateCountQuery =
@"(SELECT COUNT(CandidateID)
@"(SELECT COUNT(pr.CandidateID)
FROM dbo.Progress AS pr
WHERE pr.CustomisationID = cu.CustomisationID) AS DelegateCount";
INNER JOIN dbo.Candidates AS can ON can.CandidateID = pr.CandidateID
WHERE pr.CustomisationID = cu.CustomisationID
AND can.CentreID = @centreId) AS DelegateCount";

private const string CompletedCountQuery =
@"(SELECT COUNT(CandidateID)
@"(SELECT COUNT(pr.CandidateID)
FROM dbo.Progress AS pr
WHERE pr.CustomisationID = cu.CustomisationID AND pr.Completed IS NOT NULL) AS CompletedCount";
INNER JOIN dbo.Candidates AS can ON can.CandidateID = pr.CandidateID
WHERE pr.CustomisationID = cu.CustomisationID AND pr.Completed IS NOT NULL
AND can.CentreID = @centreId) AS CompletedCount";

private const string AllAttemptsQuery =
@"(SELECT COUNT(AssessAttemptID)
@"(SELECT COUNT(aa.AssessAttemptID)
FROM dbo.AssessAttempts AS aa
WHERE aa.CustomisationID = cu.CustomisationID AND aa.[Status] IS NOT NULL) AS AllAttempts";
INNER JOIN dbo.Candidates AS can ON can.CandidateID = aa.CandidateID
WHERE aa.CustomisationID = cu.CustomisationID AND aa.[Status] IS NOT NULL
AND can.CentreID = @centreId) AS AllAttempts";

private const string AttemptsPassedQuery =
@"(SELECT COUNT(AssessAttemptID)
@"(SELECT COUNT(aa.AssessAttemptID)
FROM dbo.AssessAttempts AS aa
WHERE aa.CustomisationID = cu.CustomisationID AND aa.[Status] = 1) AS AttemptsPassed";
INNER JOIN dbo.Candidates AS can ON can.CandidateID = aa.CandidateID
WHERE aa.CustomisationID = cu.CustomisationID AND aa.[Status] = 1
AND can.CentreID = @centreId) AS AttemptsPassed";

private readonly IDbConnection connection;
private readonly ILogger<CourseDataService> logger;
Expand Down