#487 generate detailed contents for digital sources entries - incomplete

This commit is contained in:
Hamid Reza Mohammadi 2026-02-22 21:16:17 +03:30
parent 82334a00c9
commit 62338e5dbc

View File

@ -342,12 +342,12 @@ namespace RMuseum.Services.Implementation
continue;
var resParent = await _GetCatById(context, lastParent.Id, false, false, false);
var parent = resParent.Result.Cat;
bool includesAllChildren = false;
bool includesAllChildren = true;
foreach (var child in parent.Children)
{
if(!digitalSourcesCats[digitalSource.Id].Contains(child.Id))
{
includesAllChildren = true;
includesAllChildren = false;
break;
}
}
@ -375,8 +375,41 @@ namespace RMuseum.Services.Implementation
}
else
{
var parent = cat.Ancestors.Last();
var thisCat = cat;
var lastParent = cat.Ancestors.Last();
if(lastParent != null)
{
var resParent = await _GetCatById(context, lastParent.Id, false, false, false);
var parent = resParent.Result.Cat;
while (parent != null)
{
bool includesAllChildren = false;
foreach (var child in parent.Children)
{
if (!includedCats.Any(c => c.Id == child.Id))
{
includesAllChildren = true;
break;
}
}
if (includesAllChildren)
{
thisCat = parent;
lastParent = thisCat.Ancestors.Last();
if(lastParent == null)
{
break;
}
resParent = await _GetCatById(context, lastParent.Id, false, false, false);
parent = resParent.Result.Cat;
}
else
{
break;
}
}
}
finalCats.Add(thisCat);
}
}
}