Removing usless | at the begining of externals id

This commit is contained in:
Zoe Roux 2020-02-29 22:06:39 +01:00
parent e2f76b62e2
commit 5aa222d799
4 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,7 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Kyoo.Models namespace Kyoo.Models
{ {
@ -103,7 +104,7 @@ namespace Kyoo.Models
if (Runtime == -1) if (Runtime == -1)
Runtime = other.Runtime; Runtime = other.Runtime;
ImgPrimary ??= other.ImgPrimary; ImgPrimary ??= other.ImgPrimary;
ExternalIDs = string.Join('|', ExternalIDs, other.ExternalIDs); ExternalIDs = string.Join('|', new [] { ExternalIDs, other.ExternalIDs }.Where(x => !string.IsNullOrEmpty(x)));
return this; return this;
} }
} }

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Kyoo.Models namespace Kyoo.Models
@ -29,7 +30,7 @@ namespace Kyoo.Models
Slug ??= other.Slug; Slug ??= other.Slug;
Name ??= other.Name; Name ??= other.Name;
ImgPrimary ??= other.ImgPrimary; ImgPrimary ??= other.ImgPrimary;
ExternalIDs += '|' + other.ExternalIDs; ExternalIDs = string.Join('|', new [] { ExternalIDs, other.ExternalIDs }.Where(x => !string.IsNullOrEmpty(x)));
return this; return this;
} }
} }

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Kyoo.Models namespace Kyoo.Models
@ -44,7 +45,7 @@ namespace Kyoo.Models
Overview ??= other.Overview; Overview ??= other.Overview;
Year ??= other.Year; Year ??= other.Year;
ImgPrimary ??= other.ImgPrimary; ImgPrimary ??= other.ImgPrimary;
ExternalIDs = string.Join('|', ExternalIDs, other.ExternalIDs); ExternalIDs = string.Join('|', new [] { ExternalIDs, other.ExternalIDs }.Where(x => !string.IsNullOrEmpty(x)));
return this; return this;
} }
} }

View File

@ -123,7 +123,7 @@ namespace Kyoo.Models
ImgBackdrop ??= other.ImgBackdrop; ImgBackdrop ??= other.ImgBackdrop;
if (other.Studio != null) if (other.Studio != null)
Studio ??= other.Studio; Studio ??= other.Studio;
ExternalIDs = string.Join('|', ExternalIDs, other.ExternalIDs); ExternalIDs = string.Join('|', new [] { ExternalIDs, other.ExternalIDs }.Where(x => !string.IsNullOrEmpty(x)));
return this; return this;
} }
} }