BUG FIX: Negative Percentage Enabled Creating Token Power

This commit is contained in:
Luis Fernando Molina committed 2021-12-03 21:47:01 +01:00
1 parent b47f852c7f
commit b83801cd1d
5 files changed
+18 -18

No files matched your search

@@ -326,7 +326,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
if (childNode.type === "Tokens Awarded") { continue }
let percentage = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
if (percentage !== undefined && isNaN(percentage > 0) && percentage !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
@@ -342,7 +342,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
if (childNode.type === "Tokens Awarded") { continue }
let percentage = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
if (percentage !== undefined && isNaN(percentage > 0) && percentage !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
@@ -373,7 +373,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
if (childNode.type === "Tokens Awarded") { continue }
let percentage = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
if (percentage === undefined || isNaN(percentage) || percentage < 0 === true) {
percentage = defaultPercentage
}
distributeProgramPower(childNode, programPower * percentage / 100, percentage)
@@ -388,7 +388,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
if (childNode.type === "Tokens Awarded") { continue }
let percentage = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
if (percentage === undefined || isNaN(percentage) || percentage < 0 === true) {
percentage = defaultPercentage
}
distributeProgramPower(childNode, programPower * percentage / 100, percentage)
@@ -184,7 +184,7 @@ function newGovernanceFunctionLibraryDelegationProgram() {
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
if (percentage !== undefined && isNaN(percentage > 0) && percentage !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
@@ -199,7 +199,7 @@ function newGovernanceFunctionLibraryDelegationProgram() {
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
if (percentage !== undefined && isNaN(percentage > 0) && percentage !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
@@ -233,7 +233,7 @@ function newGovernanceFunctionLibraryDelegationProgram() {
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
if (percentage === undefined || isNaN(percentage) || percentage < 0 === true) {
percentage = defaultPercentage
}
distributeProgramPower(
@@ -253,7 +253,7 @@ function newGovernanceFunctionLibraryDelegationProgram() {
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
if (percentage === undefined || isNaN(percentage) || percentage < 0 === true) {
percentage = defaultPercentage
}
distributeProgramPower(
@@ -191,7 +191,7 @@ function newGovernanceFunctionLibraryTokenPower() {
let percentage = getPercentage(childNode)
if (percentage !== undefined && isNaN(percentage) !== true) {
if (percentage !== undefined && isNaN(percentage > 0) && percentage !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
@@ -208,7 +208,7 @@ function newGovernanceFunctionLibraryTokenPower() {
if (OPAQUE_NODES_TYPES.includes(childNode.type)) { continue }
let percentage = getPercentage(childNode)
if (percentage !== undefined && isNaN(percentage) !== true) {
if (percentage !== undefined && isNaN(percentage > 0) && percentage !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
@@ -244,7 +244,7 @@ function newGovernanceFunctionLibraryTokenPower() {
if (OPAQUE_NODES_TYPES.includes(childNode.type)) { continue }
let percentage = getPercentage(childNode)
if (percentage === undefined || isNaN(percentage) === true) {
if (percentage === undefined || isNaN(percentage) || percentage < 0 === true) {
percentage = defaultPercentage
}
distributeTokenPower(
@@ -265,7 +265,7 @@ function newGovernanceFunctionLibraryTokenPower() {
if (OPAQUE_NODES_TYPES.includes(childNode.type)) { continue }
let percentage = getPercentage(childNode)
if (percentage === undefined || isNaN(percentage) === true) {
if (percentage === undefined || isNaN(percentage) || percentage < 0 === true) {
percentage = defaultPercentage
}
distributeTokenPower(
@@ -331,7 +331,7 @@ function newGovernanceFunctionLibraryVotingProgram() {
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
if (percentage !== undefined && isNaN(percentage > 0) && percentage !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
@@ -346,7 +346,7 @@ function newGovernanceFunctionLibraryVotingProgram() {
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
if (percentage !== undefined && isNaN(percentage > 0) && percentage !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
@@ -380,7 +380,7 @@ function newGovernanceFunctionLibraryVotingProgram() {
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
if (percentage === undefined || isNaN(percentage) || percentage < 0 === true) {
percentage = defaultPercentage
}
distributeProgramPower(
@@ -401,7 +401,7 @@ function newGovernanceFunctionLibraryVotingProgram() {
if (childNode === undefined) { continue }
if (childNode.type === 'Tokens Bonus') { continue }
let percentage = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
if (percentage === undefined || isNaN(percentage) || percentage < 0 === true) {
percentage = defaultPercentage
}
distributeProgramPower(
@@ -283,7 +283,7 @@ function newGovernanceUtilitiesDecendentProgram() {
for (let i = 0; i < node[usersArrayPropertyName].length; i++) {
let childNode = node[usersArrayPropertyName][i]
let percentage = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage !== undefined && isNaN(percentage) !== true) {
if (percentage !== undefined && isNaN(percentage > 0) && percentage !== true) {
totalPercentage = totalPercentage + percentage
} else {
totalNodesWithoutPercentage++
@@ -306,7 +306,7 @@ function newGovernanceUtilitiesDecendentProgram() {
for (let i = 0; i < node[usersArrayPropertyName].length; i++) {
let childNode = node[usersArrayPropertyName][i]
let percentage = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
if (percentage === undefined || isNaN(percentage) === true) {
if (percentage === undefined || isNaN(percentage) || percentage < 0 === true) {
percentage = defaultPercentage
}
distributeProgramPower(