Voting Power Fixed

This commit is contained in:
Luis Fernando Molina committed 2021-06-25 00:25:03 +02:00
1 parent d64cf914e2
commit 0570558293
2 files changed
+11 -8

No files matched your search

@@ -16,7 +16,7 @@ function newFoundationsUtilitiesBranches() {
the array, including the children of the nodes added to the result array.
*/
if (node === undefined) { return }
let resultArray = []
let resultArray = []
scanNodeBranch(node)
return resultArray
@@ -48,6 +48,7 @@ function newFoundationsUtilitiesBranches() {
break
case 'array': {
let startingNodePropertyArray = startingNode[property.name]
if (startingNodePropertyArray === undefined) { continue }
for (let m = 0; m < startingNodePropertyArray.length; m++) {
scanNodeBranch(startingNodePropertyArray[m])
}
@@ -52,21 +52,23 @@ function newGovernanceFunctionLibraryVotingProgram() {
let userProfile = userProfiles[i]
if (userProfile.tokenPowerSwitch === undefined) { continue }
if (userProfile.tokenPowerSwitch.votingProgram === undefined) { continue }
if (userProfile.tokenPowerSwitch.votingProgram.payload === undefined) { continue }
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, "Voting Program")
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
resetVotes(userProfile.tokenPowerSwitch.votingProgram)
resetVotes(program)
}
for (let i = 0; i < userProfiles.length; i++) {
let userProfile = userProfiles[i]
if (userProfile.tokenPowerSwitch === undefined) { continue }
if (userProfile.tokenPowerSwitch.votingProgram === undefined) { continue }
if (userProfile.tokenPowerSwitch.votingProgram.payload === undefined) { continue }
let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, "Voting Program")
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
userProfile.tokenPowerSwitch.votingProgram.payload.votingProgram.votes = userProfile.tokenPowerSwitch.votingProgram.payload.tokenPower
program.payload.votingProgram.votes = program.payload.tokenPower
distributeProgram(userProfile.tokenPowerSwitch.votingProgram)
distributeProgram(program)
}
function resetVotes(node) {