Skip to content

Commit 7e0584f

Browse files
authored
Merge pull request #2731 from TechnologyEnhancedLearning/Develop/Fix/TD-4277-Adding-course-to-Delegate-group
TD-4277- Added restriction to add archived courses
2 parents 66c20bd + 1f4430d commit 7e0584f

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

DigitalLearningSolutions.Data/DataServices/CourseDataService.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ FROM Customisations cu
337337
cc.CategoryName,
338338
ct.CourseTopic,
339339
CASE WHEN ({TutorialWithLearningCountQuery}) > 0 THEN 1 ELSE 0 END AS HasLearning,
340-
CASE WHEN ({TutorialWithDiagnosticCountQuery}) > 0 THEN 1 ELSE 0 END AS HasDiagnostic
340+
CASE WHEN ({TutorialWithDiagnosticCountQuery}) > 0 THEN 1 ELSE 0 END AS HasDiagnostic,
341+
CASE WHEN ap.ArchivedDate IS NULL THEN 0 ELSE 1 END AS Archived
341342
FROM Customisations AS c
342343
INNER JOIN Applications AS ap ON ap.ApplicationID = c.ApplicationID
343344
INNER JOIN CourseCategories AS cc ON ap.CourseCategoryId = cc.CourseCategoryId
@@ -869,8 +870,8 @@ public IEnumerable<CourseStatistics> GetNonArchivedCourseStatisticsAtCentreFilte
869870

870871
public IEnumerable<DelegateCourseInfo> GetDelegateCoursesInfo(int delegateId)
871872
{
872-
return connection.Query<DelegateCourseInfo>(
873-
$@"{selectDelegateCourseInfoQuery}
873+
return connection.Query<DelegateCourseInfo>(
874+
$@"{selectDelegateCourseInfoQuery}
874875
WHERE pr.CandidateID = @delegateId
875876
AND pr.RemovedDate IS NULL
876877
AND ap.DefaultContentTypeID <> 4
@@ -914,8 +915,8 @@ AND ap.DefaultContentTypeID <> 4
914915
u.ProfessionalRegistrationNumber,
915916
da.CentreID,
916917
ap.ArchivedDate",
917-
new { delegateId }
918-
);
918+
new { delegateId }
919+
);
919920
}
920921

921922
public DelegateCourseInfo? GetDelegateCourseInfoByProgressId(int progressId)

DigitalLearningSolutions.Web.Tests/Services/CourseServiceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ public void GetEligibleCoursesToAddToGroup_does_not_return_courses_already_in_gr
784784
var result = courseService.GetEligibleCoursesToAddToGroup(centreId, categoryId, groupId).ToList();
785785

786786
// Then
787-
result.Should().HaveCount(4);
787+
result.Should().HaveCount(3);
788788
result.Should().NotContain(c => c.CustomisationId == 2);
789789
}
790790

DigitalLearningSolutions.Web/Services/CourseService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ int groupId
384384
)
385385
{
386386
var allPossibleCourses = courseDataService.GetCoursesAvailableToCentreByCategory(centreId, categoryId)
387-
.Where(c => c.Active);
387+
.Where(c => c.Active && !c.Archived);
388388

389389
var groupCourseIds = groupsDataService.GetGroupCoursesVisibleToCentre(centreId)
390390
.Where(gc => gc.IsUsable && gc.GroupId == groupId)

0 commit comments

Comments
 (0)