Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
SwimmingRieux committed Sep 7, 2024
2 parents 0162a4b + fa70d43 commit b39942e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ public async Task<GraphDto> GetExpansionGraph(int nodeId, string sourceCategoryN

var inputNodes = await GetInputNodes(context, sourceCategoryName);
var outputNodes = await GetOutputNodes(context, targetCategoryName);
var validEdges = await GetValidEdges(context, edgeCategoryName, inputNodes, outputNodes);
var validEdges = await GetValidEdges(nodeId, context, edgeCategoryName, inputNodes, outputNodes);

return graphDtoCreator.CreateResultGraphDto(inputNodes.Union(outputNodes).ToList(), validEdges);
}

private async Task<List<Models.Graph.Edge.Edge>> GetValidEdges(ApplicationDbContext context, string edgeCategoryName, List<Models.Graph.Node.Node> inputNodes,
private async Task<List<Models.Graph.Edge.Edge>> GetValidEdges(int nodeId, ApplicationDbContext context, string edgeCategoryName, List<Models.Graph.Node.Node> inputNodes,
List<Models.Graph.Node.Node> outputNodes)
{

var validEdges = await context.Edges.Where(e =>
(e.EdgeSourceNodeId == nodeId || e.EdgeDestinationNodeId == nodeId) &&
e.EdgeCategory.EdgeCategoryName == edgeCategoryName &&
inputNodes.Contains(e.NodeSource) &&
outputNodes.Contains(e.NodeDestination)).ToListAsync();
Expand Down

0 comments on commit b39942e

Please sign in to comment.