From 9ac1aca6872a45f3f5cb540462420c5a38a02fee Mon Sep 17 00:00:00 2001 From: da3dsoul Date: Mon, 16 Oct 2023 10:54:01 -0400 Subject: [PATCH] Remove SortName and have it calculate based on name --- Shoko.Commons | 2 +- Shoko.Desktop/Forms/MoveSeries.xaml | 2 -- Shoko.Desktop/Forms/MoveSeries.xaml.cs | 2 -- Shoko.Desktop/MainWindow.xaml.cs | 3 --- .../UserControls/AnimeGroupControl.xaml | 9 ------- .../UserControls/AnimeSeries.xaml.cs | 1 - .../UserControls/UserAdminControl.xaml | 4 +-- .../ViewModel/Server/VM_AnimeGroup_User.cs | 25 ++++--------------- .../ViewModel/Server/VM_AnimeSeries_User.cs | 2 +- .../ViewModel/Server/VM_GroupFilter.cs | 2 +- 10 files changed, 10 insertions(+), 42 deletions(-) diff --git a/Shoko.Commons b/Shoko.Commons index 976a2f05..cd139d86 160000 --- a/Shoko.Commons +++ b/Shoko.Commons @@ -1 +1 @@ -Subproject commit 976a2f05c8d95a835a4f7fed203710141de83b75 +Subproject commit cd139d86c01a62fac78da3d3c5b89d1c702efb7a diff --git a/Shoko.Desktop/Forms/MoveSeries.xaml b/Shoko.Desktop/Forms/MoveSeries.xaml index c506f666..29dc0967 100644 --- a/Shoko.Desktop/Forms/MoveSeries.xaml +++ b/Shoko.Desktop/Forms/MoveSeries.xaml @@ -100,8 +100,6 @@ - - diff --git a/Shoko.Desktop/Forms/MoveSeries.xaml.cs b/Shoko.Desktop/Forms/MoveSeries.xaml.cs index 5e48030e..242c81b8 100644 --- a/Shoko.Desktop/Forms/MoveSeries.xaml.cs +++ b/Shoko.Desktop/Forms/MoveSeries.xaml.cs @@ -144,7 +144,6 @@ void btnOK_Click(object sender, RoutedEventArgs e) VM_AnimeGroup_User grp = new VM_AnimeGroup_User(); grp.GroupName = txtGroupName.Text.Trim(); - grp.SortName = txtGroupName.Text.Trim(); grp.AnimeGroupParentID = null; grp.Description = ""; grp.IsFave = 0; @@ -199,7 +198,6 @@ public void Init(VM_AnimeSeries_User series) Series = series; txtGroupName.Text = Series.SeriesName; - txtGroupSortName.Text = Series.SeriesName; } void txtGroupSearch_TextChanged(object sender, TextChangedEventArgs e) diff --git a/Shoko.Desktop/MainWindow.xaml.cs b/Shoko.Desktop/MainWindow.xaml.cs index ac536d16..7b5ef698 100644 --- a/Shoko.Desktop/MainWindow.xaml.cs +++ b/Shoko.Desktop/MainWindow.xaml.cs @@ -1788,7 +1788,6 @@ public void CommandBinding_Edit(object sender, ExecutedRoutedEventArgs e) GroupName = grp.GroupName, IsFave = grp.IsFave, Description = grp.Description, - SortName = grp.SortName }; } @@ -1868,7 +1867,6 @@ public void CommandBinding_Save(object sender, ExecutedRoutedEventArgs e) if (obj.GetType() == typeof(VM_AnimeGroup_User)) { VM_AnimeGroup_User grp = (VM_AnimeGroup_User)obj; - grp.SortName = grp.SortName ?? grp.GroupName; bool isnew = grp.AnimeGroupID==0; if (grp.Validate()) { @@ -2050,7 +2048,6 @@ public void CommandBinding_Cancel(object sender, ExecutedRoutedEventArgs e) //grp.AnimeGroupParentID = groupBeforeChanges.AnimeGroupParentID; grp.Description = groupBeforeChanges.Description; - grp.SortName = groupBeforeChanges.SortName; VM_MainListHelper.Instance.ViewGroups.Refresh(); EnableDisableGroupControls(true); diff --git a/Shoko.Desktop/UserControls/AnimeGroupControl.xaml b/Shoko.Desktop/UserControls/AnimeGroupControl.xaml index c40aa725..7cbb7ebc 100644 --- a/Shoko.Desktop/UserControls/AnimeGroupControl.xaml +++ b/Shoko.Desktop/UserControls/AnimeGroupControl.xaml @@ -212,15 +212,6 @@ - - - - - - - diff --git a/Shoko.Desktop/UserControls/AnimeSeries.xaml.cs b/Shoko.Desktop/UserControls/AnimeSeries.xaml.cs index 0d8d9f08..0b1a8e7c 100644 --- a/Shoko.Desktop/UserControls/AnimeSeries.xaml.cs +++ b/Shoko.Desktop/UserControls/AnimeSeries.xaml.cs @@ -539,7 +539,6 @@ void btnEditSeriesFinish_Click(object sender, RoutedEventArgs e) if (thisGrp != null) { thisGrp.GroupName = ser.GroupName; - thisGrp.SortName = ser.SeriesName; thisGrp.Save(); } } diff --git a/Shoko.Desktop/UserControls/UserAdminControl.xaml b/Shoko.Desktop/UserControls/UserAdminControl.xaml index bfbea4eb..6f276074 100644 --- a/Shoko.Desktop/UserControls/UserAdminControl.xaml +++ b/Shoko.Desktop/UserControls/UserAdminControl.xaml @@ -111,7 +111,7 @@ - + @@ -129,7 +129,7 @@ - + base.SortName,(r)=> base.SortName = r, value); } - } + public new string SortName => GroupName.ToSortName(); public new string Description { @@ -698,7 +695,6 @@ public void Populate(CL_AnimeGroup_User contract) // editable members GroupName = contract.GroupName; IsFave = contract.IsFave; - SortName = contract.SortName; DefaultAnimeSeriesID = contract.DefaultAnimeSeriesID; Description = contract.Description; @@ -715,7 +711,6 @@ public CL_AnimeGroup_Save_Request ToRequest() IsManuallyNamed = IsManuallyNamed, GroupName = GroupName, IsFave = IsFave, - SortName = SortName, Description = Description }; } @@ -893,19 +888,9 @@ private static void GetAnimeSeriesRecursive(VM_AnimeGroup_User grp, ref List AniDBAnime?.AniDBAnime?.AirDate; [JsonIgnore, XmlIgnore] - public string SortName => SeriesName; + public string SortName => SeriesName.ToSortName(); [JsonIgnore, XmlIgnore] public string DateTimeCreatedAsString => DateTimeCreated.ToString("dd MMM yyyy - HH:mm", Commons.Culture.Global); diff --git a/Shoko.Desktop/ViewModel/Server/VM_GroupFilter.cs b/Shoko.Desktop/ViewModel/Server/VM_GroupFilter.cs index b8502c5c..f936a05c 100644 --- a/Shoko.Desktop/ViewModel/Server/VM_GroupFilter.cs +++ b/Shoko.Desktop/ViewModel/Server/VM_GroupFilter.cs @@ -78,7 +78,7 @@ public string SortName return split[1] + part2; } } - return GroupFilterName; + return GroupFilterName.ToSortName(); } }