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
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace DigitalLearningSolutions.Data.Migrations
{
using FluentMigrator;

[Migration(202407221645)]
public class AlterGetCurrentCoursesForCandidate_V3 : Migration
{
public override void Up()
{
Execute.Sql(Properties.Resources.TD_4243_Alter_GetCurrentCoursesForCandidate_V2_proc_up);
}
public override void Down()
{
Execute.Sql(Properties.Resources.TD_4243_Alter_GetCurrentCoursesForCandidate_V2_proc_down);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -406,4 +406,10 @@
<data name="TD_4223_Alter_GroupCustomisation_Add_V2_Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Scripts\TD-4223-Alter_GroupCustomisation_Add_V2_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>
</root>
<data name="TD_4243_Alter_GetCurrentCoursesForCandidate_V2_proc_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\TD-4243_Alter_GetCurrentCoursesForCandidate_V2_proc_down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="TD_4243_Alter_GetCurrentCoursesForCandidate_V2_proc_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\TD-4243_Alter_GetCurrentCoursesForCandidate_V2_proc_up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
</root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

/****** Object: StoredProcedure [dbo].[GetCurrentCoursesForCandidate_V2] Script Date: 22/07/2024 10:11:35 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author: Kevin Whittaker
-- Create date: 16/12/2016
-- Description: Returns a list of active progress records for the candidate.
-- Change 18/09/2018: Adds logic to exclude Removed courses from returned results.
-- =============================================
ALTER PROCEDURE [dbo].[GetCurrentCoursesForCandidate_V2]
-- Add the parameters for the stored procedure here
@CandidateID int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here
SELECT p.ProgressID, (CASE WHEN cu.CustomisationName <> '' THEN a.ApplicationName + ' - ' + cu.CustomisationName ELSE a.ApplicationName END) AS CourseName, p.CustomisationID, p.SubmittedTime AS LastAccessed,
p.FirstSubmittedTime AS StartedDate, p.DiagnosticScore, p.PLLocked, cu.IsAssessed, dbo.CheckCustomisationSectionHasDiagnostic(p.CustomisationID, 0)
AS HasDiagnostic, dbo.CheckCustomisationSectionHasLearning(p.CustomisationID, 0) AS HasLearning,
COALESCE
((SELECT COUNT(Passes) AS Passes
FROM (SELECT COUNT(AssessAttemptID) AS Passes
FROM AssessAttempts AS aa
WHERE (CandidateID = p.CandidateID) AND (CustomisationID = p.CustomisationID) AND (Status = 1)
GROUP BY SectionNumber) AS derivedtbl_2), 0) AS Passes,
(SELECT COUNT(SectionID) AS Sections
FROM Sections AS s
WHERE (ApplicationID = cu.ApplicationID)) AS Sections, p.CompleteByDate, CAST(CASE WHEN p.CompleteByDate IS NULL THEN 0 WHEN p.CompleteByDate < getDate()
THEN 2 WHEN p.CompleteByDate < DATEADD(M, + 1, getDate()) THEN 1 ELSE 0 END AS INT) AS OverDue, p.EnrollmentMethodID, dbo.GetCohortGroupCustomisationID(p.ProgressID) AS GroupCustomisationID, p.SupervisorAdminID

FROM Progress AS p INNER JOIN
Customisations AS cu ON p.CustomisationID = cu.CustomisationID INNER JOIN
Applications AS a ON cu.ApplicationID = a.ApplicationID
WHERE (p.Completed IS NULL) AND (p.RemovedDate IS NULL) AND (p.CandidateID = @CandidateID)AND (cu.CustomisationName <> 'ESR') AND (a.ArchivedDate IS NULL) AND(cu.Active = 1) AND
((p.SubmittedTime > DATEADD(M, -6, getDate()) OR (EnrollmentMethodID <> 1)) OR NOT (p.CompleteByDate IS NULL) AND NOT
(p.SubmittedTime < DATEADD(MONTH, -6, GETDATE()) AND (p.EnrollmentMethodID = 1) AND (p.CompleteByDate < GETDATE())))
ORDER BY p.SubmittedTime Desc
END
GO
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@


/****** Object: StoredProcedure [dbo].[GetCurrentCoursesForCandidate_V2] Script Date: 22/07/2024 10:11:35 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author: Kevin Whittaker
-- Create date: 16/12/2016
-- Description: Returns a list of active progress records for the candidate.
-- Change 18/09/2018: Adds logic to exclude Removed courses from returned results.
-- =============================================
ALTER PROCEDURE [dbo].[GetCurrentCoursesForCandidate_V2]
-- Add the parameters for the stored procedure here
@CandidateID int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here
SELECT p.ProgressID, (CASE WHEN cu.CustomisationName <> '' THEN a.ApplicationName + ' - ' + cu.CustomisationName ELSE a.ApplicationName END) AS CourseName, p.CustomisationID, p.SubmittedTime AS LastAccessed,
p.FirstSubmittedTime AS StartedDate, p.DiagnosticScore, p.PLLocked, cu.IsAssessed, dbo.CheckCustomisationSectionHasDiagnostic(p.CustomisationID, 0)
AS HasDiagnostic, dbo.CheckCustomisationSectionHasLearning(p.CustomisationID, 0) AS HasLearning,
COALESCE
((SELECT COUNT(Passes) AS Passes
FROM (SELECT COUNT(AssessAttemptID) AS Passes
FROM AssessAttempts AS aa
WHERE (CandidateID = p.CandidateID) AND (CustomisationID = p.CustomisationID) AND (Status = 1)
GROUP BY SectionNumber) AS derivedtbl_2), 0) AS Passes,
(SELECT COUNT(SectionID) AS Sections
FROM Sections AS s
WHERE (ApplicationID = cu.ApplicationID)) AS Sections, p.CompleteByDate, CAST(CASE WHEN p.CompleteByDate IS NULL THEN 0 WHEN p.CompleteByDate < getDate()
THEN 2 WHEN p.CompleteByDate < DATEADD(M, + 1, getDate()) THEN 1 ELSE 0 END AS INT) AS OverDue, p.EnrollmentMethodID, dbo.GetCohortGroupCustomisationID(p.ProgressID) AS GroupCustomisationID, p.SupervisorAdminID

FROM Progress AS p INNER JOIN
Customisations AS cu ON p.CustomisationID = cu.CustomisationID INNER JOIN
Applications AS a ON cu.ApplicationID = a.ApplicationID INNER JOIN
CentreApplications AS ca ON ca.ApplicationID = a.ApplicationID AND ca.CentreID = cu.CentreID
WHERE (p.Completed IS NULL) AND (p.RemovedDate IS NULL) AND (p.CandidateID = @CandidateID)AND (cu.CustomisationName <> 'ESR') AND (a.ArchivedDate IS NULL) AND(cu.Active = 1) AND
((p.SubmittedTime > DATEADD(M, -6, getDate()) OR (EnrollmentMethodID <> 1)) OR NOT (p.CompleteByDate IS NULL) AND NOT
(p.SubmittedTime < DATEADD(MONTH, -6, GETDATE()) AND (p.EnrollmentMethodID = 1) AND (p.CompleteByDate < GETDATE())))
ORDER BY p.SubmittedTime Desc
END
GO