mirror of https://github.com/Radarr/Radarr
Movies in list don't sort correctly #174
This commit is contained in:
parent
81ebbcad70
commit
d5504043c5
|
@ -0,0 +1,45 @@
|
||||||
|
using System.Data;
|
||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
{
|
||||||
|
[Migration(115)]
|
||||||
|
public class update_movie_sorttitle : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
// Create.Column("SortTitle").OnTable("Series").AsString().Nullable();
|
||||||
|
Execute.WithConnection(SetSortTitles);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetSortTitles(IDbConnection conn, IDbTransaction tran)
|
||||||
|
{
|
||||||
|
using (IDbCommand getSeriesCmd = conn.CreateCommand())
|
||||||
|
{
|
||||||
|
getSeriesCmd.Transaction = tran;
|
||||||
|
getSeriesCmd.CommandText = @"SELECT Id, Title FROM Movies";
|
||||||
|
using (IDataReader seriesReader = getSeriesCmd.ExecuteReader())
|
||||||
|
{
|
||||||
|
while (seriesReader.Read())
|
||||||
|
{
|
||||||
|
var id = seriesReader.GetInt32(0);
|
||||||
|
var title = seriesReader.GetString(1);
|
||||||
|
|
||||||
|
var sortTitle = Parser.Parser.NormalizeTitle(title).ToLower();
|
||||||
|
|
||||||
|
using (IDbCommand updateCmd = conn.CreateCommand())
|
||||||
|
{
|
||||||
|
updateCmd.Transaction = tran;
|
||||||
|
updateCmd.CommandText = "UPDATE Movies SET SortTitle = ? WHERE Id = ?";
|
||||||
|
updateCmd.AddParameter(sortTitle);
|
||||||
|
updateCmd.AddParameter(id);
|
||||||
|
|
||||||
|
updateCmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -327,7 +327,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
imdbMovie.TmdbId = result.id;
|
imdbMovie.TmdbId = result.id;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
imdbMovie.SortTitle = result.title;
|
imdbMovie.SortTitle = Parser.Parser.NormalizeTitle(result.title);
|
||||||
imdbMovie.Title = result.title;
|
imdbMovie.Title = result.title;
|
||||||
string titleSlug = result.title;
|
string titleSlug = result.title;
|
||||||
imdbMovie.TitleSlug = titleSlug.ToLower().Replace(" ", "-");
|
imdbMovie.TitleSlug = titleSlug.ToLower().Replace(" ", "-");
|
||||||
|
|
|
@ -183,6 +183,7 @@
|
||||||
<Compile Include="Datastore\Migration\002_remove_tvrage_imdb_unique_constraint.cs" />
|
<Compile Include="Datastore\Migration\002_remove_tvrage_imdb_unique_constraint.cs" />
|
||||||
<Compile Include="Datastore\Migration\003_remove_clean_title_from_scene_mapping.cs" />
|
<Compile Include="Datastore\Migration\003_remove_clean_title_from_scene_mapping.cs" />
|
||||||
<Compile Include="Datastore\Migration\004_updated_history.cs" />
|
<Compile Include="Datastore\Migration\004_updated_history.cs" />
|
||||||
|
<Compile Include="Datastore\Migration\115_update_movie_sorttitle.cs" />
|
||||||
<Compile Include="Datastore\Migration\111_remove_bitmetv.cs" />
|
<Compile Include="Datastore\Migration\111_remove_bitmetv.cs" />
|
||||||
<Compile Include="Datastore\Migration\112_remove_torrentleech.cs" />
|
<Compile Include="Datastore\Migration\112_remove_torrentleech.cs" />
|
||||||
<Compile Include="Datastore\Migration\114_remove_fanzub.cs" />
|
<Compile Include="Datastore\Migration\114_remove_fanzub.cs" />
|
||||||
|
|
|
@ -15,10 +15,10 @@ var Collection = PageableCollection.extend({
|
||||||
tableName : 'movie',
|
tableName : 'movie',
|
||||||
|
|
||||||
state : {
|
state : {
|
||||||
sortKey : 'title',
|
sortKey : 'sortTitle',
|
||||||
order : 1,
|
order : 1,
|
||||||
pageSize : 100000,
|
pageSize : 100000,
|
||||||
secondarySortKey : 'title',
|
secondarySortKey : 'sortTitle',
|
||||||
secondarySortOrder : -1
|
secondarySortOrder : -1
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ var Collection = PageableCollection.extend({
|
||||||
|
|
||||||
sortMappings : {
|
sortMappings : {
|
||||||
title : {
|
title : {
|
||||||
sortKey : 'title'
|
sortKey : 'sortTitle'
|
||||||
},
|
},
|
||||||
|
|
||||||
nextAiring : {
|
nextAiring : {
|
||||||
|
|
Loading…
Reference in New Issue