Skip to content
Open
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,19 @@


namespace DigitalLearningSolutions.Data.Migrations
{
using FluentMigrator;

[Migration(202608061170)]
public class _202608051545_TD_7596_Alter_StoreDiagScoreSCO : Migration
{
public override void Up()
{
Execute.Sql(Properties.Resources.TD_7596_Alter_StoreDiagScoreSCO_Up);
}
public override void Down()
{
Execute.Sql(Properties.Resources.TD_7596_Alter_StoreDiagScoreSCO_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 @@ -559,4 +559,10 @@
<data name="TD_7592_Alter_GetNotificationsForAdminUser_Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Scripts\TD-7592-Alter_GetNotificationsForAdminUser_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>
<data name="TD_7596_Alter_StoreDiagScoreSCO_Down" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\TD_7596_Alter_StoreDiagScoreSCO_Down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>
<data name="TD_7596_Alter_StoreDiagScoreSCO_Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\TD_7596_Alter_StoreDiagScoreSCO_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
</root>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/****** Object: StoredProcedure [dbo].[StoreDiagScoreSCO] Script Date: 05/08/2026 08:51:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Kevin Whittaker
-- Create date: 08/08/2018
-- Description: Updates the diagnostic score for a delegate using ProgressID and TutorialID to identify ASPProgress record to update
-- =============================================
ALTER PROCEDURE [dbo].[StoreDiagScoreSCO]
@score INT,
@progressid INT,
@TutorialID INT
AS
BEGIN
SET NOCOUNT ON;

-- Step 1: Resolve the target TutorialID safely and efficiently
DECLARE @TargetTutorialID INT;

-- Get the ApplicationID associated with the given progress ID once
SELECT TOP (1) @TargetTutorialID = t.TutorialID
FROM Tutorials AS t
INNER JOIN Sections AS s ON t.SectionID = s.SectionID
INNER JOIN Customisations AS c ON s.ApplicationID = c.ApplicationID
INNER JOIN Progress AS p ON c.CustomisationID = p.CustomisationID
WHERE p.ProgressID = @progressid
AND (t.OriginalTutorialID = @TutorialID OR t.TutorialID = @TutorialID);

-- Step 2: Perform the update on aspProgress
UPDATE ap
SET
DiagHigh = CASE WHEN ap.DiagHigh > @score THEN ap.DiagHigh ELSE @score END,
DiagLow = (CASE WHEN DiagLow < @score AND DiagAttempts > 0 THEN DiagLow ELSE @score END),
DiagLast = @score,
DiagAttempts = ap.DiagAttempts + 1
FROM aspProgress AS ap
WHERE ap.ProgressID = @progressid
AND ap.TutorialID = @TargetTutorialID;

END
Loading