You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CASE WHEN ap.ArchivedDate IS NOT NULL THEN 0 ELSE cu.Active END AS Active,
635
+
cu.AllCentres,
636
+
ap.ApplicationId,
637
+
ap.ApplicationName,
638
+
cu.CustomisationName,
639
+
{DelegateCountQuery},
640
+
{CompletedCountQuery},
641
+
{AllAttemptsQuery},
642
+
{AttemptsPassedQuery},
643
+
cu.HideInLearnerPortal,
644
+
cc.CategoryName,
645
+
ct.CourseTopic,
646
+
cu.LearningTimeMins AS LearningMinutes,
647
+
cu.IsAssessed,
648
+
CASE WHEN ap.ArchivedDate IS NOT NULL THEN 1 ELSE 0 END AS Archived,
649
+
((SELECT COUNT(pr.CandidateID)
650
+
FROM dbo.Progress AS pr WITH (NOLOCK)
651
+
INNER JOIN dbo.Candidates AS can WITH (NOLOCK) ON can.CandidateID = pr.CandidateID
652
+
WHERE pr.CustomisationID = cu.CustomisationID
653
+
AND can.CentreID = @centreId
654
+
AND RemovedDate IS NULL) -
655
+
(SELECT COUNT(pr.CandidateID)
656
+
FROM dbo.Progress AS pr WITH (NOLOCK)
657
+
INNER JOIN dbo.Candidates AS can WITH (NOLOCK) ON can.CandidateID = pr.CandidateID
658
+
WHERE pr.CustomisationID = cu.CustomisationID AND pr.Completed IS NOT NULL
659
+
AND can.CentreID = @centreId)) AS InProgressCount ";
660
+
stringcourseStatisticsFromTable=@$" FROM dbo.Customisations AS cu WITH (NOLOCK)
661
+
INNER JOIN dbo.CentreApplications AS ca WITH (NOLOCK) ON ca.ApplicationID = cu.ApplicationID
662
+
INNER JOIN dbo.Applications AS ap WITH (NOLOCK) ON ap.ApplicationID = ca.ApplicationID
663
+
INNER JOIN dbo.CourseCategories AS cc WITH (NOLOCK) ON cc.CourseCategoryID = ap.CourseCategoryID
664
+
INNER JOIN dbo.CourseTopics AS ct WITH (NOLOCK) ON ct.CourseTopicID = ap.CourseTopicId
665
+
666
+
LEFT JOIN CoursePrompts AS cp1 WITH (NOLOCK)
667
+
ON cu.CourseField1PromptID = cp1.CoursePromptID
668
+
LEFT JOIN CoursePrompts AS cp2 WITH (NOLOCK)
669
+
ON cu.CourseField2PromptID = cp2.CoursePromptID
670
+
LEFT JOIN CoursePrompts AS cp3 WITH (NOLOCK)
671
+
ON cu.CourseField3PromptID = cp3.CoursePromptID
672
+
673
+
WHERE (ap.CourseCategoryID = @categoryId OR @categoryId IS NULL)
674
+
AND (cu.CentreID = @centreId OR (cu.AllCentres = 1 AND ca.Active = 1))
675
+
AND ca.CentreID = @centreId
676
+
AND ap.DefaultContentTypeID <> 4
677
+
AND ( ap.ApplicationName + ' ' + ' ' + cu.CustomisationName LIKE N'%' + @searchString + N'%')
678
+
AND ((@isActive = 'Any') OR (@isActive = 'true' AND (cu.Active = 1 AND ap.ArchivedDate IS NULL)) OR (@isActive = 'false' AND ((cu.Active = 0 OR ap.ArchivedDate IS NOT NULL))))
679
+
AND ((@categoryName = 'Any') OR (cc.CategoryName = @categoryName))
680
+
AND ((@courseTopic = 'Any') OR (ct.CourseTopic = @courseTopic))
681
+
AND ((@hasAdminFields = 'Any') OR (@hasAdminFields = 'true' AND (cp1.CoursePrompt IS NOT NULL OR cp2.CoursePrompt IS NOT NULL OR cp3.CoursePrompt IS NOT NULL))
682
+
OR (@hasAdminFields = 'false' AND (cp1.CoursePrompt IS NULL AND cp2.CoursePrompt IS NULL AND cp3.CoursePrompt IS NULL)))";
0 commit comments