From a59ccf33eb6dcbd884a64236f66d384575cbf0d9 Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Thu, 7 Jan 2021 15:59:22 +0330 Subject: [PATCH] #59 pages import: working version --- RMuseum/Services/Implementation/GanjoorService.cs | 6 +++--- .../Implementation/LongRunningJobProgressServiceEF.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs index 60e4722c..d987637f 100644 --- a/RMuseum/Services/Implementation/GanjoorService.cs +++ b/RMuseum/Services/Implementation/GanjoorService.cs @@ -1055,7 +1055,7 @@ namespace RMuseum.Services.Implementation } await context.SaveChangesAsync(); - job = (await jobProgressServiceEF.UpdateJob(job.Id, 50, "phase 2")).Result; + job = (await jobProgressServiceEF.UpdateJob(job.Id, 0, "phase 2")).Result; var orphanPages = await context.GanjoorPages.Include(p => p.Poem).Where(p => p.FullUrl == null).ToListAsync(); @@ -1064,7 +1064,7 @@ namespace RMuseum.Services.Implementation foreach (var page in orphanPages) { - job = (await jobProgressServiceEF.UpdateJob(job.Id, 50 + i / count * 100, "phase 2")).Result; + job = (await jobProgressServiceEF.UpdateJob(job.Id, i++, "phase 2")).Result; string fullUrl = page.UrlSlug; string fullTitle = page.Title; @@ -1094,7 +1094,7 @@ namespace RMuseum.Services.Implementation fullUrl = cat.FullUrl; while (cat.ParentId != null) { - cat = await context.GanjoorCategories.Where(c => c.Id == cat.Id).SingleOrDefaultAsync(); + cat = await context.GanjoorCategories.Where(c => c.Id == cat.ParentId).SingleOrDefaultAsync(); if (cat != null) { fullTitle = cat.Title + " ยป " + fullTitle; diff --git a/RSecurityBackend/Services/Implementation/LongRunningJobProgressServiceEF.cs b/RSecurityBackend/Services/Implementation/LongRunningJobProgressServiceEF.cs index ea27b285..51f6d987 100644 --- a/RSecurityBackend/Services/Implementation/LongRunningJobProgressServiceEF.cs +++ b/RSecurityBackend/Services/Implementation/LongRunningJobProgressServiceEF.cs @@ -54,7 +54,7 @@ namespace RSecurityBackend.Services.Implementation { try { - var jobs = await _context.LongRunningJobs.Where(j => (succeeded || (!succeeded && j.Succeeded == false)) && (failed || (!failed && j.Exception != ""))).OrderByDescending(j => j.StartTime).ToArrayAsync(); + var jobs = await _context.LongRunningJobs.Where(j => (succeeded || (!succeeded && j.Succeeded == false)) && (failed || (!failed && j.Exception == ""))).OrderByDescending(j => j.StartTime).ToArrayAsync(); return new RServiceResult(jobs); }