Skip to content

Commit 374eca4

Browse files
committed
Merge branch 'DLS-Release-v1.1.1' into UAT
2 parents 4b8a3ab + 16c7fba commit 374eca4

File tree

38 files changed

+422
-445
lines changed

38 files changed

+422
-445
lines changed

.github/workflows/build-and-deploy-production.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@v4
2121

22-
- name: Setup .NET Core SDK 8.0
22+
- name: Setup .NET Core SDK 6.0
2323
uses: actions/setup-dotnet@v4
2424
with:
25-
dotnet-version: 8.0.x
25+
dotnet-version: 6.0.x
2626
- name: Setup node
2727
uses: actions/setup-node@v4
2828
with:

.github/workflows/build-and-deploy-uat.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ jobs:
2222
steps:
2323
- uses: actions/checkout@v4
2424

25-
- name: Setup .NET Core SDK 8.0
25+
- name: Setup .NET Core SDK 6.0
2626
uses: actions/setup-dotnet@v4
2727
with:
28-
dotnet-version: 8.0.x
28+
dotnet-version: 6.0.x
2929
- name: Setup node
3030
uses: actions/setup-node@v4
3131
with:

.github/workflows/continuous-integration-workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414

15-
- name: Setup .NET Core SDK 8.0
15+
- name: Setup .NET Core SDK 6.0
1616
uses: actions/setup-dotnet@v4
1717
with:
18-
dotnet-version: 8.0.x
18+
dotnet-version: 6.0.x
1919

2020
- name: Add TechnologyEnhancedLearning as nuget package source
2121
run: dotnet nuget add source https://pkgs.dev.azure.com/e-LfH/_packaging/LearningHubFeed/nuget/v3/index.json --name TechnologyEnhancedLearning --username 'kevin.whittaker' --password ${{ secrets.AZURE_DEVOPS_PAT }} --store-password-in-clear-text
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+

2+
namespace DigitalLearningSolutions.Data.Migrations
3+
{
4+
using FluentMigrator;
5+
6+
[Migration(202410071401)]
7+
public class UpdateCandidateAssessmentSupervisorsTabl : ForwardOnlyMigration
8+
{
9+
public override void Up()
10+
{
11+
Execute.Sql($@"UPDATE cas
12+
SET SelfAssessmentSupervisorRoleID = (SELECT ID FROM SelfAssessmentSupervisorRoles
13+
WHERE SelfAssessmentID = ssr.SelfAssessmentID and AllowDelegateNomination = 1)
14+
FROM CandidateAssessmentSupervisors cas INNER JOIN
15+
SelfAssessmentSupervisorRoles ssr ON cas.SelfAssessmentSupervisorRoleID = ssr.ID
16+
AND cas.Removed IS NULL AND ssr.AllowDelegateNomination = 0 INNER JOIN
17+
SupervisorDelegates sd ON cas.SupervisorDelegateId = sd.ID INNER JOIN
18+
AdminAccounts aa ON sd.SupervisorAdminID = aa.ID WHERE aa.IsSupervisor = 0 AND aa.IsNominatedSupervisor = 1");
19+
}
20+
}
21+
}

DigitalLearningSolutions.Data.Migrations/Properties/Resources.resx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,4 +469,13 @@
469469
<data name="TD_4950_Alter_GetAssessmentResultsByDelegate_UP" type="System.Resources.ResXFileRef, System.Windows.Forms">
470470
<value>..\Scripts\TD_4950_Alter_GetAssessmentResultsByDelegate_UP.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
471471
</data>
472+
<data name="TD-4950-dboGetOtherCentresForSelfAssessmentCreateOrAlter" type="System.Resources.ResXFileRef, System.Windows.Forms">
473+
<value>..\Resources\TD-4950-dboGetOtherCentresForSelfAssessmentCreateOrAlter.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
474+
</data>
475+
<data name="TD_4878_Alter_GetActivitiesForDelegateEnrolment_Down" type="System.Resources.ResXFileRef, System.Windows.Forms">
476+
<value>..\Scripts\TD-4878-Alter_GetActivitiesForDelegateEnrolment_Down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
477+
</data>
478+
<data name="TD_4878_Alter_GetActivitiesForDelegateEnrolment_Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
479+
<value>..\Scripts\TD-4878-Alter_GetActivitiesForDelegateEnrolment_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
480+
</data>
472481
</root>

DigitalLearningSolutions.Data/DataServices/CourseDataService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ int EnrolOnActivitySelfAssessment(int selfAssessmentId, int candidateId, int sup
139139
public IEnumerable<DelegateAssessmentStatistics> GetDelegateAssessmentStatisticsAtCentre(string searchString, int centreId, string categoryName, string isActive, int? categoryId);
140140

141141
bool IsSelfEnrollmentAllowed(int customisationId);
142-
Customisation? GetCourse(int customisationId);
142+
Customisation? GetCourse(int? customisationId);
143143
}
144144

145145
public class CourseDataService : ICourseDataService
@@ -2024,7 +2024,7 @@ public bool IsSelfEnrollmentAllowed(int customisationId)
20242024
return selfRegister > 0;
20252025
}
20262026

2027-
public Customisation? GetCourse(int customisationId)
2027+
public Customisation? GetCourse(int? customisationId)
20282028
{
20292029
return connection.Query<Customisation>(
20302030
@"SELECT CustomisationID

DigitalLearningSolutions.Data/DataServices/FrameworkDataService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ FROM CourseTopics
299299

300300
private const string FrameworkTables =
301301
@"Frameworks AS FW LEFT OUTER JOIN
302-
FrameworkCollaborators AS fwc ON fwc.FrameworkID = FW.ID AND fwc.AdminID = @adminId
302+
FrameworkCollaborators AS fwc ON fwc.FrameworkID = FW.ID AND fwc.AdminID = @adminId AND COALESCE(IsDeleted, 0) = 0
303303
LEFT OUTER JOIN FrameworkReviews AS fwr ON fwc.ID = fwr.FrameworkCollaboratorID AND fwr.Archived IS NULL AND fwr.ReviewComplete IS NULL";
304304

305305
private const string AssessmentQuestionFields =

DigitalLearningSolutions.Data/DataServices/SelfAssessmentDataService/SelfAssessmentSupervisorDataService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int delegateUserId
7878
return connection.Query<SelfAssessmentSupervisor>(
7979
@$"{SelectSelfAssessmentSupervisorQuery}
8080
WHERE (sd.Removed IS NULL) AND (cas.Removed IS NULL) AND (ca.DelegateUserID = @delegateUserId)
81-
AND (ca.SelfAssessmentID = @selfAssessmentId)
81+
AND (ca.SelfAssessmentID = @selfAssessmentId) AND (au.Supervisor = 1 or au.NominatedSupervisor = 1)
8282
AND (au.CategoryID = 0 OR au.CategoryID IN (select CategoryID from SelfAssessments where ID = @selfAssessmentId))
8383
ORDER BY SupervisorName",
8484
new { selfAssessmentId, delegateUserId }
@@ -95,7 +95,7 @@ int delegateUserId
9595
WHERE (sd.Removed IS NULL) AND (cas.Removed IS NULL) AND (sd.DelegateUserID = @delegateUserId)
9696
AND (ca.SelfAssessmentID = @selfAssessmentId) AND (sd.SupervisorAdminID IS NOT NULL)
9797
AND (coalesce(sasr.ResultsReview, 1) = 1)
98-
AND au.Active = 1
98+
AND au.Active = 1 AND (au.Supervisor = 1 or au.NominatedSupervisor = 1)
9999
AND (au.CategoryID = 0 OR au.CategoryID IN (select CategoryID from SelfAssessments where ID = @selfAssessmentId))
100100
ORDER BY SupervisorName",
101101
new { selfAssessmentId, delegateUserId }

DigitalLearningSolutions.Data/Helpers/FilteringHelper.cs

Lines changed: 64 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public static string BuildFilterValueString(string group, string propertyName, s
3636
{
3737
return existingFilterString;
3838
}
39-
40-
return existingFilterString + FilterSeparator + newFilterToAdd;
39+
var filterString = existingFilterString + FilterSeparator + newFilterToAdd;
40+
return RemoveDuplicateFilters(filterString, newFilterToAdd);
4141
}
4242

4343
public static string? GetFilterString(
@@ -46,7 +46,8 @@ public static string BuildFilterValueString(string group, string propertyName, s
4646
bool clearFilters,
4747
HttpRequest request,
4848
string cookieName,
49-
string? defaultFilterValue = null
49+
string? defaultFilterValue = null,
50+
IEnumerable<FilterModel>? availableFilters = null
5051
)
5152
{
5253
var cookieHasBeenSet = request.Cookies.ContainsKey(cookieName);
@@ -59,18 +60,19 @@ public static string BuildFilterValueString(string group, string propertyName, s
5960

6061
if (cookieHasBeenSet && noFiltersInQueryParams)
6162
{
62-
return request.Cookies[cookieName] == EmptyFiltersCookieValue ? null : request.Cookies[cookieName];
63+
return request.Cookies[cookieName] == EmptyFiltersCookieValue ? null : GetValidFilters(request.Cookies[cookieName], availableFilters);
6364
}
6465

65-
return noFiltersInQueryParams
66-
? defaultFilterValue
67-
: AddNewFilterToFilterString(existingFilterString, newFilterToAdd);
68-
}
66+
var filterString = noFiltersInQueryParams
67+
? defaultFilterValue
68+
: AddNewFilterToFilterString(existingFilterString, newFilterToAdd);
6969

70+
return GetValidFilters(filterString, availableFilters);
71+
}
7072
public static string? GetCategoryAndTopicFilterString(
71-
string? categoryFilterString,
72-
string? topicFilterString
73-
)
73+
string? categoryFilterString,
74+
string? topicFilterString
75+
)
7476
{
7577
if (categoryFilterString == null && topicFilterString == null)
7678
{
@@ -169,6 +171,57 @@ public static string GetFilterValueForRegistrationPrompt(int promptNumber, strin
169171
return BuildFilterValueString(group, group.Split('(')[0], propertyValue);
170172
}
171173

174+
public static string? GetValidFilters(string? existingFilterString, IEnumerable<FilterModel>? availableFilters)
175+
{
176+
if (string.IsNullOrEmpty(existingFilterString) || availableFilters == null)
177+
{
178+
return null;
179+
}
180+
var existingFilters = existingFilterString.Split(FilterSeparator);
181+
var validFilterValues = availableFilters
182+
.SelectMany(filter => filter.FilterOptions)
183+
.Select(option => option.FilterValue)
184+
.ToHashSet();
185+
186+
var filteredResults = existingFilters
187+
.Where(entry => IsFilterInvalid(entry, validFilterValues))
188+
.ToList();
189+
var newFilterString = string.Join(FilterSeparator, filteredResults);
190+
191+
return string.IsNullOrEmpty(newFilterString) ? null : newFilterString;
192+
}
193+
194+
private static bool IsFilterInvalid(string filterEntry, HashSet<string> validFilterValues)
195+
{
196+
if (validFilterValues.Contains(filterEntry)) return true;
197+
return false;
198+
}
199+
public static string RemoveDuplicateFilters(string? existingFilterString, string newFilterToAdd)
200+
{
201+
if (string.IsNullOrEmpty(existingFilterString))
202+
{
203+
return existingFilterString ?? string.Empty;
204+
}
205+
var selectedFilters = existingFilterString.Split(FilteringHelper.FilterSeparator).ToList();
206+
if (!string.IsNullOrEmpty(newFilterToAdd))
207+
{
208+
var filterHeader = newFilterToAdd.Split(FilteringHelper.Separator)[0];
209+
var dupfilters = selectedFilters.Where(x => x.Contains(filterHeader));
210+
if (dupfilters.Count() > 1)
211+
{
212+
foreach (var filter in selectedFilters)
213+
{
214+
if (filter.Contains(filterHeader))
215+
{
216+
selectedFilters.Remove(filter);
217+
existingFilterString = string.Join(FilteringHelper.FilterSeparator, selectedFilters);
218+
break;
219+
}
220+
}
221+
}
222+
}
223+
return existingFilterString;
224+
}
172225
private static IEnumerable<FilterOptionModel> GetFilterOptionsForPromptWithOptions(Prompt prompt)
173226
{
174227
var group = GetFilterGroupForPrompt(prompt);

DigitalLearningSolutions.Web.Tests/Controllers/LearningPortal/CurrentTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ bool apiIsAccessible
4444

4545
var bannerText = "bannerText";
4646
A.CallTo(() => courseService.GetCurrentCourses(CandidateId)).Returns(currentCourses);
47-
A.CallTo(() => selfAssessmentService.GetSelfAssessmentsForCandidate(DelegateUserId, A<int>._)).Returns(selfAssessments);
47+
A.CallTo(() => selfAssessmentService.GetSelfAssessmentsForCandidate(DelegateUserId, A<int>._, A<int>._)).Returns(selfAssessments);
4848
A.CallTo(() => actionPlanService.GetIncompleteActionPlanResources(DelegateUserId))
4949
.Returns((actionPlanResources, apiIsAccessible));
5050
A.CallTo(() => centresService.GetBannerText(CentreId)).Returns(bannerText);
@@ -426,7 +426,7 @@ public void MarkActionPlanResourceAsComplete_does_not_call_service_with_invalid_
426426
private void GivenCurrentActivitiesAreEmptyLists()
427427
{
428428
A.CallTo(() => courseService.GetCurrentCourses(A<int>._)).Returns(new List<CurrentCourse>());
429-
A.CallTo(() => selfAssessmentService.GetSelfAssessmentsForCandidate(A<int>._, A<int>._))
429+
A.CallTo(() => selfAssessmentService.GetSelfAssessmentsForCandidate(A<int>._, A<int>._, A<int>._))
430430
.Returns(new List<CurrentSelfAssessment>());
431431
A.CallTo(() => actionPlanService.GetIncompleteActionPlanResources(A<int>._))
432432
.Returns((new List<ActionPlanResource>(), false));

0 commit comments

Comments
 (0)