fix
This commit is contained in:
parent
78c3f3f797
commit
e13be5c09a
1 changed files with 28 additions and 29 deletions
|
|
@ -752,38 +752,37 @@ func (c *compiler) validateBoardLinks(g *d2graph.Graph) {
|
|||
}
|
||||
|
||||
func hasBoard(root *d2graph.Graph, ida []string) bool {
|
||||
for i := 0; i < len(ida); i += 2 {
|
||||
id := ida[i]
|
||||
if i == 0 && id == "root" {
|
||||
i--
|
||||
continue
|
||||
if len(ida) == 0 {
|
||||
return true
|
||||
}
|
||||
if i == len(ida)-1 {
|
||||
if ida[0] == "root" {
|
||||
return hasBoard(root, ida[1:])
|
||||
}
|
||||
id := ida[0]
|
||||
if len(ida) == 1 {
|
||||
return root.Name == id
|
||||
}
|
||||
nextID := ida[i+1]
|
||||
nextID := ida[1]
|
||||
switch id {
|
||||
case "layers":
|
||||
for _, b := range root.Layers {
|
||||
if b.Name == nextID {
|
||||
return hasBoard(b, ida[i+1:])
|
||||
return hasBoard(b, ida[2:])
|
||||
}
|
||||
}
|
||||
case "scenarios":
|
||||
for _, b := range root.Scenarios {
|
||||
if b.Name == nextID {
|
||||
return hasBoard(b, ida[i+1:])
|
||||
return hasBoard(b, ida[2:])
|
||||
}
|
||||
}
|
||||
case "steps":
|
||||
for _, b := range root.Steps {
|
||||
if b.Name == nextID {
|
||||
return hasBoard(b, ida[i+1:])
|
||||
return hasBoard(b, ida[2:])
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue