Count Children done
This commit is contained in:
1 parent
378470baf6
commit
78cd4a475b
1 file changed
+49
@@ -17,6 +17,15 @@ function newNodeChildren () {
|
||||
case 'Network Node': {
|
||||
return countChildrenNetworkNode(parentNode, childNode)
|
||||
}
|
||||
case 'Social Bots': {
|
||||
return countChildrenSocialBots(parentNode, childNode)
|
||||
}
|
||||
case 'Telegram Bot': {
|
||||
return countChildrenTelegramBot(parentNode, childNode)
|
||||
}
|
||||
case 'Announcement': {
|
||||
return countChildrenAnnouncement(parentNode, childNode)
|
||||
}
|
||||
case 'Layer Manager': {
|
||||
return countChildrenLayerManager(parentNode, childNode)
|
||||
}
|
||||
@@ -215,6 +224,46 @@ function newNodeChildren () {
|
||||
return response
|
||||
}
|
||||
|
||||
function countChildrenSocialBots (parentNode, childNode) {
|
||||
let response = {
|
||||
childrenCount: 0,
|
||||
childIndex: undefined
|
||||
}
|
||||
|
||||
for (let i = 0; i < parentNode.bots.length; i++) {
|
||||
let child = parentNode.bots[i]
|
||||
response.childrenCount++
|
||||
if (child.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
function countChildrenTelegramBot (parentNode, childNode) {
|
||||
let response = {
|
||||
childrenCount: 0,
|
||||
childIndex: undefined
|
||||
}
|
||||
|
||||
for (let i = 0; i < parentNode.announcements.length; i++) {
|
||||
let child = parentNode.announcements[i]
|
||||
response.childrenCount++
|
||||
if (child.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
function countChildrenAnnouncement (parentNode, childNode) {
|
||||
let response = {
|
||||
childrenCount: 0,
|
||||
childIndex: undefined
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
function countChildrenLayerManager (parentNode, childNode) {
|
||||
let response = {
|
||||
childrenCount: 0,
|
||||
|
||||
Reference in new issue
Block a user