CrazyIter_Bin 10 ヶ月 前
コミット
32bc6b0366

+ 28 - 5
TEAMModelOS.SDK/Models/Service/KnowledgeService.cs

@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using MathNet.Numerics.Distributions;
+using System.Collections.Generic;
 using System.Linq;
 using TEAMModelOS.SDK.Extension;
 
@@ -11,6 +12,7 @@ namespace TEAMModelOS.SDK.Models.Service
 
             HashSet<string> points = new HashSet<string>();
             List<Block> blocks = new List<Block>();
+            blocks.AddRange(knowledge.blocks);
             var pidNull= knowledge.nodes.FindAll(x => string.IsNullOrWhiteSpace(x.pid));
             if (pidNull.IsNotEmpty()) {
                 foreach (var isnull in pidNull) {
@@ -21,14 +23,22 @@ namespace TEAMModelOS.SDK.Models.Service
             foreach (var node in tree)
             {
                 points.Add(node.name);
-                if (!node.children.IsNotEmpty()) {
-                    blocks.Add(new Block { name=node.name, source=2, points=  node.children!=null ? node.children.Select(x => x.name).Distinct().ToList() : new List<string>() });
+                var blck = blocks.Find(x => x.name.Equals(node.name));
+                if (blck!= null)
+                {
+                    blck.points.AddRange(node.children.Select(x => x.name));
+                    blck.points= blck.points.Distinct().ToList();
+                }
+                else
+                {
+                    blocks.Add(new Block { name=node.name, source=2, points= node.children.Select(x => x.name).Distinct().ToList() });
                 }
                 node.pid=knowledge.id;
                 node.allcids= KnowledgeService.GetChildIds(node, points, blocks);
             }
-            blocks.AddRange(knowledge.blocks);
+            
             knowledge.points.AddRange(points);
+            knowledge.points=knowledge.points.Distinct().ToList();
             KnowledgeTreeDto knowledgeTrees = new KnowledgeTreeDto
             {
                 id= knowledge.id,
@@ -132,7 +142,20 @@ namespace TEAMModelOS.SDK.Models.Service
                     childIds.AddRange(allcids);
                     child.allcids=allcids.Count>100 ? child.children.Select(x => x.id).ToList() : allcids;
                     points.Add(child.name);
-                    blocks.Add(new Block { name=child.name, source=2, points=  child.children!=null ? child.children.Select(x => x.name).ToList() : new List<string>() });
+                    if (child.children.IsNotEmpty())
+                    {
+                        var blck = blocks.Find(x => x.name.Equals(child.name));
+                        if (blck!= null)
+                        {
+                            blck.points.AddRange(child.children.Select(x => x.name));
+                            blck.points= blck.points.Distinct().ToList();
+                        }
+                        else {
+                            
+                        }
+                        blocks.Add(new Block { name=child.name, source=2, points= child.children.Select(x => x.name).Distinct().ToList() });
+                    }
+
                 }
             }
             return childIds;

ファイルの差分が大きいため隠しています
+ 28 - 28
TEAMModelOS/appsettings.Development.json