Skip to content

Commit c805543

Browse files
committed
TD-2508- column 'HideInLearnerPortal' added in stored proc select list.
1 parent 71e0cb1 commit c805543

File tree

8 files changed

+24
-19
lines changed

8 files changed

+24
-19
lines changed

DigitalLearningSolutions.Data.Migrations/202309141644_AlterGetActivitiesForDelegateEnrolmentSPNotHiddenInLearningPortal.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
{
33
using FluentMigrator;
44

5-
[Migration(202309141644)]
5+
[Migration(202309141645)]
66
public class AlterGetActivitiesForDelegateEnrolmentSPNotHiddenInLearningPortal : Migration
77
{
88
public override void Up()
99
{
10-
Execute.Sql(Properties.Resources.TD_2508_GetActivitiesForDelegateEnrolmentNotHiddenInLearningPortal);
10+
Execute.Sql(Properties.Resources.TD_2508_GetActivitiesForDelegateEnrolmentHiddenInLearningPortalTweak);
1111
}
1212
public override void Down()
1313
{
14-
Execute.Sql(Properties.Resources.TD_2508_GetActivitiesForDelegateEnrolmentNotHiddenInLearningPortal_down);
14+
Execute.Sql(Properties.Resources.TD_2508_GetActivitiesForDelegateEnrolmentHiddenInLearningPortalTweak_down);
1515
}
1616
}
1717
}

DigitalLearningSolutions.Data.Migrations/Properties/Resources.Designer.cs

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DigitalLearningSolutions.Data.Migrations/Properties/Resources.resx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,10 @@
307307
<data name="TD_1943_CookiePolicyContentHtml" type="System.Resources.ResXFileRef, System.Windows.Forms">
308308
<value>..\Resources\TD_1943_CookiePolicyContentHtml.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
309309
</data>
310-
<data name="TD_2508_GetActivitiesForDelegateEnrolmentNotHiddenInLearningPortal" type="System.Resources.ResXFileRef, System.Windows.Forms">
311-
<value>..\Scripts\TD-2508-GetActivitiesForDelegateEnrolmentNotHiddenInLearningPortal.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
310+
<data name="TD_2508_GetActivitiesForDelegateEnrolmentHiddenInLearningPortalTweak" type="System.Resources.ResXFileRef, System.Windows.Forms">
311+
<value>..\Scripts\TD-2508-GetActivitiesForDelegateEnrolmentHiddenInLearningPortalTweak.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
312312
</data>
313-
<data name="TD_2508_GetActivitiesForDelegateEnrolmentNotHiddenInLearningPortal_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
314-
<value>..\Scripts\TD-2508-GetActivitiesForDelegateEnrolmentNotHiddenInLearningPortal_down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
313+
<data name="TD_2508_GetActivitiesForDelegateEnrolmentHiddenInLearningPortalTweak_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
314+
<value>..\Scripts\TD-2508-GetActivitiesForDelegateEnrolmentHiddenInLearningPortalTweak_down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
315315
</data>
316316
</root>
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ AS
2222
-- Insert statements for procedure here
2323
(SELECT cu.CustomisationID, cu.Active, cu.CurrentVersion, cu.CentreID, cu.ApplicationID, (CASE WHEN cu.CustomisationName <> '' THEN a.ApplicationName + ' - ' + cu.CustomisationName ELSE a.ApplicationName END) AS CourseName, cu.CustomisationText, 0 AS IncludesSignposting, 0 AS IsSelfAssessment, cu.SelfRegister AS SelfRegister,
2424
cu.IsAssessed, dbo.CheckCustomisationSectionHasDiagnostic(cu.CustomisationID, 0) AS HasDiagnostic,
25-
dbo.CheckCustomisationSectionHasLearning(cu.CustomisationID, 0) AS HasLearning, (SELECT BrandName FROM Brands WHERE BrandID = a.BrandID) AS Brand, (SELECT CategoryName FROM CourseCategories WHERE CourseCategoryID = a.CourseCategoryID) AS Category, (SELECT CourseTopic FROM CourseTopics WHERE CourseTopicID = a.CourseTopicID) AS Topic, dbo.CheckDelegateStatusForCustomisation(cu.CustomisationID, @DelegateID) AS DelegateStatus
25+
dbo.CheckCustomisationSectionHasLearning(cu.CustomisationID, 0) AS HasLearning, (SELECT BrandName FROM Brands WHERE BrandID = a.BrandID) AS Brand, (SELECT CategoryName FROM CourseCategories WHERE CourseCategoryID = a.CourseCategoryID) AS Category, (SELECT CourseTopic FROM CourseTopics WHERE CourseTopicID = a.CourseTopicID) AS Topic, dbo.CheckDelegateStatusForCustomisation(cu.CustomisationID, @DelegateID) AS DelegateStatus,
26+
cu.HideInLearnerPortal
2627
FROM Customisations AS cu INNER JOIN
2728
Applications AS a
2829
ON cu.ApplicationID = a.ApplicationID
@@ -32,8 +33,7 @@ AS
3233
(a.ArchivedDate IS NULL) AND
3334
(dbo.CheckDelegateStatusForCustomisation(cu.CustomisationID, @DelegateID) IN (0,1,4)) AND
3435
(cu.CustomisationName <> 'ESR') AND
35-
(a.CourseCategoryID = @CategoryId OR @CategoryId =0) AND
36-
(cu.HideInLearnerPortal = 0)
36+
(a.CourseCategoryID = @CategoryId OR @CategoryId =0)
3737
UNION ALL
3838
SELECT SA.ID AS CustomisationID, 1 AS Active, 1 AS CurrentVersion, CSA.CentreID as CentreID, 0 AS ApplicationID, SA.Name AS CourseName, SA.Description AS CustomisationText, SA.IncludesSignposting, 1 AS IsSelfAssessment, CSA.AllowEnrolment AS SelfRegister, 0 AS IsAssessed, 0 AS HasDiagnostic, 0 AS HasLearning,
3939
(SELECT BrandName
@@ -42,7 +42,8 @@ AS
4242
(SELECT CategoryName
4343
FROM CourseCategories
4444
WHERE (CourseCategoryID = SA.CategoryID)) AS Category,
45-
'' AS Topic, IIF(CA.RemovedDate IS NULL,0,1) AS DelegateStatus
45+
'' AS Topic, IIF(CA.RemovedDate IS NULL,0,1) AS DelegateStatus,
46+
null AS HideInLearnerPortal
4647
FROM SelfAssessments AS SA
4748
INNER JOIN CentreSelfAssessments AS CSA ON SA.Id = CSA.SelfAssessmentID AND CSA.CentreId = @centreId AND CSA.AllowEnrolment = 1
4849
LEFT JOIN CandidateAssessments AS CA ON CSA.SelfAssessmentID=CA.SelfAssessmentID AND CA.DelegateUserID = (SELECT UserID from DelegateAccounts where ID=@DelegateID)

DigitalLearningSolutions.Data/Models/Courses/AvailableCourse.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public string? Topic
1616
set => topic = GetValidOrNull(value);
1717
}
1818
public int DelegateStatus { get; set; }
19+
public int HideInLearnerPortal { get; set; }
1920

2021
private string? category;
2122
private string? topic;

DigitalLearningSolutions.Web.Tests/TestHelpers/AvailableCourseHelper.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public static AvailableCourse CreateDefaultAvailableCourse(
1616
string brand = "Brand 1",
1717
string? category = "Category 1",
1818
string? topic = "Topic 1",
19-
int delegateStatus = 0
19+
int delegateStatus = 0,
20+
int hideInLearnerPortal =0
2021
)
2122
{
2223
return new AvailableCourse
@@ -29,7 +30,8 @@ public static AvailableCourse CreateDefaultAvailableCourse(
2930
Brand = brand,
3031
Category = category,
3132
Topic = topic,
32-
DelegateStatus = delegateStatus
33+
DelegateStatus = delegateStatus,
34+
HideInLearnerPortal = hideInLearnerPortal
3335
};
3436
}
3537
public static AvailablePageViewModel AvailableViewModelFromController(LearningPortalController controller)

DigitalLearningSolutions.Web/Controllers/LearningPortalController/Available.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using DigitalLearningSolutions.Web.Helpers;
77
using DigitalLearningSolutions.Web.ViewModels.LearningPortal.Available;
88
using Microsoft.AspNetCore.Mvc;
9+
using System.Linq;
910

1011
public partial class LearningPortalController
1112
{
@@ -23,7 +24,7 @@ public IActionResult Available(
2324
var availableCourses = courseDataService.GetAvailableCourses(
2425
User.GetCandidateIdKnownNotNull(),
2526
User.GetCentreIdKnownNotNull()
26-
);
27+
).Where(course => course.HideInLearnerPortal == 0).ToList();
2728
var bannerText = GetBannerText();
2829
var searchSortPaginationOptions = new SearchSortFilterAndPaginateOptions(
2930
new SearchOptions(searchString),
@@ -50,7 +51,7 @@ public IActionResult AllAvailableItems()
5051
var availableCourses = courseDataService.GetAvailableCourses(
5152
User.GetCandidateIdKnownNotNull(),
5253
User.GetCentreIdKnownNotNull()
53-
);
54+
).Where(course => course.HideInLearnerPortal == 0).ToList();
5455
var model = new AllAvailableItemsPageViewModel(availableCourses);
5556
return View("Available/AllAvailableItems", model);
5657
}

0 commit comments

Comments
 (0)