removing unpublished poets stats

This commit is contained in:
Hamid Reza Mohammadi 2021-07-03 19:26:08 +04:30
parent f15bdaa8aa
commit 7f34df9345

View File

@ -137,8 +137,11 @@ namespace RMuseum.Services.Implementation
try
{
var poetsCoupletCounts =
await context.GanjoorVerses.Include(v => v.Poem).ThenInclude(p => p.Cat).AsNoTracking()
.Where(v => v.VersePosition == VersePosition.Right || v.VersePosition == VersePosition.CenteredVerse1)
await context.GanjoorVerses.Include(v => v.Poem).ThenInclude(p => p.Cat).ThenInclude(c => c.Poet).AsNoTracking()
.Where(v =>
v.Poem.Cat.Poet.Published
&&
(v.VersePosition == VersePosition.Right || v.VersePosition == VersePosition.CenteredVerse1))
.GroupBy(v => new { v.Poem.Cat.PoetId })
.Select(g => new { PoetId = g.Key.PoetId, Count = g.Count() })
.ToListAsync();