mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Fix seasons add
This commit is contained in:
parent
9b606cf9ac
commit
ae6121f3aa
1
back/.gitignore
vendored
1
back/.gitignore
vendored
@ -2,6 +2,7 @@ out
|
|||||||
libtranscoder.so
|
libtranscoder.so
|
||||||
libtranscoder.dylib
|
libtranscoder.dylib
|
||||||
transcoder.dll
|
transcoder.dll
|
||||||
|
kyoo_datadir
|
||||||
|
|
||||||
video
|
video
|
||||||
.env
|
.env
|
||||||
|
@ -152,7 +152,7 @@ namespace Kyoo.Core.Controllers
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override async Task<Episode> Create(Episode obj)
|
public override async Task<Episode> Create(Episode obj)
|
||||||
{
|
{
|
||||||
obj.ShowSlug = obj.Show?.Slug ?? _database.Shows.First(x => x.Id == obj.ShowId).Slug;
|
obj.ShowSlug = obj.Show?.Slug ?? (await _database.Shows.FirstAsync(x => x.Id == obj.ShowId)).Slug;
|
||||||
await base.Create(obj);
|
await base.Create(obj);
|
||||||
_database.Entry(obj).State = EntityState.Added;
|
_database.Entry(obj).State = EntityState.Added;
|
||||||
await _database.SaveChangesAsync(() =>
|
await _database.SaveChangesAsync(() =>
|
||||||
@ -176,6 +176,11 @@ namespace Kyoo.Core.Controllers
|
|||||||
}
|
}
|
||||||
resource.ShowId = resource.Show.Id;
|
resource.ShowId = resource.Show.Id;
|
||||||
}
|
}
|
||||||
|
if (resource.SeasonId == null && resource.SeasonNumber != null)
|
||||||
|
{
|
||||||
|
resource.Season = await _database.Seasons.FirstOrDefaultAsync(x => x.ShowId == resource.ShowId
|
||||||
|
&& x.SeasonNumber == resource.SeasonNumber);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user