diff --git a/CHANGELOG.md b/CHANGELOG.md index c2ee1ee7..05e2b33f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added - Include audio language metadata in all streaming modes +### Changed +- Use case-insensitive sorting for collections page and `Add to Collection` dialog +- Use natural sorting for schedules page and `Add to Schedule` dialog + ### Fixed - Fix flooding schedule items that have a fixed start time diff --git a/ErsatzTV.Application/MediaCollections/Queries/GetPagedCollectionsHandler.cs b/ErsatzTV.Application/MediaCollections/Queries/GetPagedCollectionsHandler.cs index bf7b99b7..b002284b 100644 --- a/ErsatzTV.Application/MediaCollections/Queries/GetPagedCollectionsHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Queries/GetPagedCollectionsHandler.cs @@ -33,6 +33,7 @@ namespace ErsatzTV.Application.MediaCollections.Queries List page = await dbContext.Collections.FromSqlRaw( @"SELECT * FROM Collection ORDER BY Name + COLLATE NOCASE LIMIT {0} OFFSET {1}", request.PageSize, request.PageNum * request.PageSize) diff --git a/ErsatzTV/ErsatzTV.csproj b/ErsatzTV/ErsatzTV.csproj index bffdd28b..e5ef6f10 100644 --- a/ErsatzTV/ErsatzTV.csproj +++ b/ErsatzTV/ErsatzTV.csproj @@ -35,6 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/ErsatzTV/Pages/Schedules.razor b/ErsatzTV/Pages/Schedules.razor index 3fed54b6..3342f8c3 100644 --- a/ErsatzTV/Pages/Schedules.razor +++ b/ErsatzTV/Pages/Schedules.razor @@ -4,6 +4,7 @@ @using ErsatzTV.Application.ProgramSchedules.Queries @using ErsatzTV.Application.Configuration.Queries @using ErsatzTV.Application.Configuration.Commands +@using NaturalSort.Extension @inject IDialogService _dialog @inject IMediator _mediator @@ -135,7 +136,7 @@ await _mediator.Send(new SaveConfigElementByKey(ConfigElementKey.SchedulesPageSize, state.PageSize.ToString())); List schedules = await _mediator.Send(new GetAllProgramSchedules()); - IOrderedEnumerable sorted = schedules.OrderBy(s => s.Name); + IOrderedEnumerable sorted = schedules.OrderBy(s => s.Name, new NaturalSortComparer(StringComparison.CurrentCultureIgnoreCase)); // TODO: properly page this data return new TableData diff --git a/ErsatzTV/Shared/AddToCollectionDialog.razor b/ErsatzTV/Shared/AddToCollectionDialog.razor index bcb80689..e7a46638 100644 --- a/ErsatzTV/Shared/AddToCollectionDialog.razor +++ b/ErsatzTV/Shared/AddToCollectionDialog.razor @@ -72,7 +72,7 @@ protected override async Task OnParametersSetAsync() { _collections = await _mediator.Send(new GetAllCollections()) - .Map(list => new[] { _newCollection }.Append(list).ToList()); + .Map(list => new[] { _newCollection }.Append(list.OrderBy(vm => vm.Name, StringComparer.CurrentCultureIgnoreCase)).ToList()); if (_memoryCache.TryGetValue("AddToCollectionDialog.SelectedCollectionId", out int id)) { diff --git a/ErsatzTV/Shared/AddToScheduleDialog.razor b/ErsatzTV/Shared/AddToScheduleDialog.razor index 675324d0..72cc02d3 100644 --- a/ErsatzTV/Shared/AddToScheduleDialog.razor +++ b/ErsatzTV/Shared/AddToScheduleDialog.razor @@ -1,5 +1,6 @@ @using ErsatzTV.Application.ProgramSchedules @using ErsatzTV.Application.ProgramSchedules.Queries +@using NaturalSort.Extension @inject IMediator _mediator
@@ -49,7 +50,8 @@ private ProgramScheduleViewModel _selectedSchedule; protected override async Task OnParametersSetAsync() => - _schedules = await _mediator.Send(new GetAllProgramSchedules()); + _schedules = await _mediator.Send(new GetAllProgramSchedules()) + .Map(list => list.OrderBy(vm => vm.Name, new NaturalSortComparer(StringComparison.CurrentCultureIgnoreCase)).ToList()); private string FormatText() => $"Select the schedule to add the {EntityType} {EntityName}";