Skip to content

Commit ae97692

Browse files
authored
Merge pull request #2156 from TechnologyEnhancedLearning/Develop/fix/TD-2180-Search-IssueFix
TD-2180-Search text with spaces fixed.
2 parents fb3e8ed + a05750f commit ae97692

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

DigitalLearningSolutions.Data/DataServices/CourseDataService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ LEFT JOIN CoursePrompts AS cp3 WITH (NOLOCK)
727727
AND (cu.CentreID = @centreId OR (cu.AllCentres = 1 AND ca.Active = @allCentreCourses))
728728
AND ca.CentreID = @centreId
729729
AND ap.DefaultContentTypeID <> 4
730-
AND ( ap.ApplicationName + ' ' + ' ' + cu.CustomisationName LIKE N'%' + @searchString + N'%')
730+
AND ( ap.ApplicationName + IIF(cu.CustomisationName IS NULL, '', ' - ' + cu.CustomisationName) LIKE N'%' + @searchString + N'%')
731731
AND ((@isActive = 'Any') OR (@isActive = 'true' AND (cu.Active = 1 AND ap.ArchivedDate IS NULL)) OR (@isActive = 'false' AND ((cu.Active = 0 OR ap.ArchivedDate IS NOT NULL))))
732732
AND ((@categoryName = 'Any') OR (cc.CategoryName = @categoryName))
733733
AND ((@courseTopic = 'Any') OR (ct.CourseTopic = @courseTopic))

DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/DelegateCoursesController.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public IActionResult Index(
6060
int? itemsPerPage = 10
6161
)
6262
{
63+
searchString = searchString == null ? string.Empty : searchString.Trim();
6364
sortBy ??= DefaultSortByOptions.Name.PropertyName;
6465
sortDirection ??= GenericSortingHelper.Ascending;
6566

@@ -130,13 +131,13 @@ public IActionResult Index(
130131
}
131132
}
132133

133-
var (courses, resultCount)= courseService.GetCentreCourses(searchString ?? string.Empty, offSet, (int)itemsPerPage, sortBy, sortDirection, centreId, categoryId, true,null,
134+
var (courses, resultCount) = courseService.GetCentreCourses(searchString ?? string.Empty, offSet, (int)itemsPerPage, sortBy, sortDirection, centreId, categoryId, true, null,
134135
isActive, categoryName, courseTopic, hasAdminFields);
135136
if (courses.Count() == 0 && resultCount > 0)
136137
{
137138
page = 1;
138139
offSet = 0;
139-
(courses, resultCount) = courseService.GetCentreCourses(searchString ?? string.Empty, offSet, (int)itemsPerPage, sortBy, sortDirection, centreId, categoryId, true,null,
140+
(courses, resultCount) = courseService.GetCentreCourses(searchString ?? string.Empty, offSet, (int)itemsPerPage, sortBy, sortDirection, centreId, categoryId, true, null,
140141
isActive, categoryName, courseTopic, hasAdminFields);
141142
}
142143

0 commit comments

Comments
 (0)