Skip to content

Commit

Permalink
Merge pull request #2862 from TechnologyEnhancedLearning/Develop/Fixe…
Browse files Browse the repository at this point in the history
…s/TD-4471-Issueswith'Search'functionalitywhenJSturnedoffon'Trackingsystem-Centreadministrators'screen

TD-4471 Issues with 'Search' functionality when JS turned off on 'Tracking system - Centre administrators' screen
  • Loading branch information
rshrirohit authored Oct 17, 2024
2 parents 7eef360 + c611e00 commit 1c6b8bd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions DigitalLearningSolutions.Data/Helpers/NameQueryHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@ public static string GetSortableFullName(string? firstName, string lastName)
{
return string.IsNullOrWhiteSpace(firstName) ? lastName : $"{lastName}, {firstName}";
}

public static string GetSortableFullName(string? firstName, string lastName, string? primaryEmail, string? centreEmail)
{
var name = string.IsNullOrWhiteSpace(firstName) ? lastName : $"{lastName}, {firstName}";
var email = CentreEmailHelper.GetEmailForCentreNotifications( primaryEmail!, centreEmail );
return $"{name} ({email})";
}
}
}
2 changes: 1 addition & 1 deletion DigitalLearningSolutions.Data/Models/User/AdminEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public AdminEntity(
public override string SearchableName
{
get => SearchableNameOverrideForFuzzySharp ??
NameQueryHelper.GetSortableFullName(UserAccount.FirstName, UserAccount.LastName);
NameQueryHelper.GetSortableFullName(UserAccount.FirstName, UserAccount.LastName, UserAccount.PrimaryEmail, UserCentreDetails?.Email);
set => SearchableNameOverrideForFuzzySharp = value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public IActionResult Index(
Request,
AdminFilterCookieName
);

searchString = searchString == null ? null : searchString.Trim();
var centreId = User.GetCentreIdKnownNotNull();
var adminsAtCentre = userService.GetAdminsByCentreId(centreId);
var categories = courseCategoriesService.GetCategoriesForCentreAndCentrallyManagedCourses(centreId);
Expand Down

0 comments on commit 1c6b8bd

Please sign in to comment.