mirror of
https://github.com/C9Glax/tranga.git
synced 2025-05-22 06:03:01 +02:00
Remove unnecessary Attachments
This commit is contained in:
parent
622198a09e
commit
6258e07f20
@ -36,7 +36,6 @@ public class DownloadAvailableChaptersJob : Job
|
|||||||
|
|
||||||
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
|
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
|
||||||
{
|
{
|
||||||
context.Attach(Manga);
|
|
||||||
context.Entry(Manga).Collection<Chapter>(m => m.Chapters).Load();
|
context.Entry(Manga).Collection<Chapter>(m => m.Chapters).Load();
|
||||||
return Manga.Chapters.Select(chapter => new DownloadSingleChapterJob(chapter, this));
|
return Manga.Chapters.Select(chapter => new DownloadSingleChapterJob(chapter, this));
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ public class DownloadMangaCoverJob : Job
|
|||||||
|
|
||||||
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
|
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
|
||||||
{
|
{
|
||||||
context.Attach(Manga);
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Manga.CoverFileNameInCache = Manga.MangaConnector.SaveCoverImageToCache(Manga);
|
Manga.CoverFileNameInCache = Manga.MangaConnector.SaveCoverImageToCache(Manga);
|
||||||
|
@ -45,8 +45,6 @@ public class DownloadSingleChapterJob : Job
|
|||||||
|
|
||||||
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
|
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
|
||||||
{
|
{
|
||||||
context.Attach(Chapter);
|
|
||||||
context.Attach(Chapter.ParentManga);
|
|
||||||
string[] imageUrls = Chapter.ParentManga.MangaConnector.GetChapterImageUrls(Chapter);
|
string[] imageUrls = Chapter.ParentManga.MangaConnector.GetChapterImageUrls(Chapter);
|
||||||
if (imageUrls.Length < 1)
|
if (imageUrls.Length < 1)
|
||||||
{
|
{
|
||||||
@ -107,8 +105,7 @@ public class DownloadSingleChapterJob : Job
|
|||||||
Chapter.Downloaded = true;
|
Chapter.Downloaded = true;
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
|
||||||
context.Jobs.Load();
|
if (context.Jobs.ToList().Any(j =>
|
||||||
if (context.Jobs.AsEnumerable().Any(j =>
|
|
||||||
{
|
{
|
||||||
if (j.JobType != JobType.UpdateChaptersDownloadedJob)
|
if (j.JobType != JobType.UpdateChaptersDownloadedJob)
|
||||||
return false;
|
return false;
|
||||||
|
@ -40,7 +40,6 @@ public class RetrieveChaptersJob : Job
|
|||||||
|
|
||||||
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
|
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
|
||||||
{
|
{
|
||||||
context.Attach(Manga);
|
|
||||||
context.Entry(Manga).Collection<Chapter>(m => m.Chapters).Load();
|
context.Entry(Manga).Collection<Chapter>(m => m.Chapters).Load();
|
||||||
// This gets all chapters that are not downloaded
|
// This gets all chapters that are not downloaded
|
||||||
Chapter[] allChapters = Manga.MangaConnector.GetChapters(Manga, Language);
|
Chapter[] allChapters = Manga.MangaConnector.GetChapters(Manga, Language);
|
||||||
|
@ -36,7 +36,6 @@ public class UpdateChaptersDownloadedJob : Job
|
|||||||
|
|
||||||
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
|
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
|
||||||
{
|
{
|
||||||
context.Attach(Manga);
|
|
||||||
context.Entry(Manga).Collection<Chapter>(m => m.Chapters).Load();
|
context.Entry(Manga).Collection<Chapter>(m => m.Chapters).Load();
|
||||||
return Manga.Chapters.Select(c => new UpdateSingleChapterDownloadedJob(c, this));
|
return Manga.Chapters.Select(c => new UpdateSingleChapterDownloadedJob(c, this));
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ public class UpdateSingleChapterDownloadedJob : Job
|
|||||||
|
|
||||||
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
|
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
|
||||||
{
|
{
|
||||||
context.Attach(Chapter);
|
|
||||||
Chapter.Downloaded = Chapter.CheckDownloaded();
|
Chapter.Downloaded = Chapter.CheckDownloaded();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
Loading…
x
Reference in New Issue
Block a user