diff --git a/Projects/Governance/UI/Function-Libraries/DelegationProgram.js b/Projects/Governance/UI/Function-Libraries/DelegationProgram.js index 3b568d226..faea2d240 100644 --- a/Projects/Governance/UI/Function-Libraries/DelegationProgram.js +++ b/Projects/Governance/UI/Function-Libraries/DelegationProgram.js @@ -15,7 +15,8 @@ function newGovernanceFunctionLibraryDelegationProgram() { pools, userProfiles, "delegationProgram", - "Delegation-Bonus" + "Delegation-Bonus", + "Delegation Program" ) /* We will first reset all the delegate power, and then distribute it. diff --git a/Projects/Governance/UI/Function-Libraries/MentorshipProgram.js b/Projects/Governance/UI/Function-Libraries/MentorshipProgram.js index 3d3a57852..7784f4bf4 100644 --- a/Projects/Governance/UI/Function-Libraries/MentorshipProgram.js +++ b/Projects/Governance/UI/Function-Libraries/MentorshipProgram.js @@ -14,7 +14,8 @@ function newGovernanceFunctionLibraryMentorshipProgram() { pools, userProfiles, "mentorshipProgram", - "Mentorship-Bonus" + "Mentorship-Bonus", + "Mentorship Program" ) UI.projects.governance.utilities.decendentProgram.run( diff --git a/Projects/Governance/UI/Function-Libraries/ReferralProgram.js b/Projects/Governance/UI/Function-Libraries/ReferralProgram.js index 121dc232e..028ee9a57 100644 --- a/Projects/Governance/UI/Function-Libraries/ReferralProgram.js +++ b/Projects/Governance/UI/Function-Libraries/ReferralProgram.js @@ -14,7 +14,8 @@ function newGovernanceFunctionLibraryReferralProgram() { pools, userProfiles, "referralProgram", - "Referrals-Bonus" + "Referrals-Bonus", + "Referral Program" ) UI.projects.governance.utilities.decendentProgram.run( diff --git a/Projects/Governance/UI/Function-Libraries/SupportProgram.js b/Projects/Governance/UI/Function-Libraries/SupportProgram.js index 9646cf9b2..c75ff05c2 100644 --- a/Projects/Governance/UI/Function-Libraries/SupportProgram.js +++ b/Projects/Governance/UI/Function-Libraries/SupportProgram.js @@ -14,7 +14,8 @@ function newGovernanceFunctionLibrarySupportProgram() { pools, userProfiles, "supportProgram", - "Support-Bonus" + "Support-Bonus", + "Support Program" ) UI.projects.governance.utilities.decendentProgram.run( diff --git a/Projects/Governance/UI/Function-Libraries/VotingProgram.js b/Projects/Governance/UI/Function-Libraries/VotingProgram.js index 39ce8b477..9481d0875 100644 --- a/Projects/Governance/UI/Function-Libraries/VotingProgram.js +++ b/Projects/Governance/UI/Function-Libraries/VotingProgram.js @@ -19,7 +19,8 @@ function newGovernanceFunctionLibraryVotingProgram() { pools, userProfiles, "votingProgram", - "Voting-Bonus" + "Voting-Bonus", + "Voting Program" ) /* Reset Votes at Pools */ diff --git a/Projects/Governance/UI/Utilities/BonusProgram.js b/Projects/Governance/UI/Utilities/BonusProgram.js index be737a778..6e97ec814 100644 --- a/Projects/Governance/UI/Utilities/BonusProgram.js +++ b/Projects/Governance/UI/Utilities/BonusProgram.js @@ -9,7 +9,8 @@ function newFoundationsUtilitiesBonusProgram() { pools, userProfiles, programPropertyName, - programCodeName + programCodeName, + programNodeType ) { let programPoolTokenReward /* @@ -30,39 +31,43 @@ function newFoundationsUtilitiesBonusProgram() { let userProfile = userProfiles[i] if (userProfile.tokenPowerSwitch === undefined) { continue } - if (userProfile.tokenPowerSwitch[programPropertyName] === undefined) { continue } - if (userProfile.tokenPowerSwitch[programPropertyName].payload === undefined) { continue } + let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, programNodeType) + if (program === undefined) { continue } + if (program.payload === undefined) { continue } - resetProgram(userProfile.tokenPowerSwitch[programPropertyName]) + resetProgram(program) } for (let i = 0; i < userProfiles.length; i++) { let userProfile = userProfiles[i] if (userProfile.tokenPowerSwitch === undefined) { continue } - if (userProfile.tokenPowerSwitch[programPropertyName] === undefined) { continue } - if (userProfile.tokenPowerSwitch[programPropertyName].payload === undefined) { continue } + let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, programNodeType) + if (program === undefined) { continue } + if (program.payload === undefined) { continue } - validateProgram(userProfile.tokenPowerSwitch[programPropertyName]) + validateProgram(program, userProfile) } for (let i = 0; i < userProfiles.length; i++) { let userProfile = userProfiles[i] if (userProfile.tokenPowerSwitch === undefined) { continue } - if (userProfile.tokenPowerSwitch[programPropertyName] === undefined) { continue } - if (userProfile.tokenPowerSwitch[programPropertyName].payload === undefined) { continue } - if (userProfile.tokenPowerSwitch[programPropertyName].payload[programPropertyName].isActive === false) { continue } + let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, programNodeType) + if (program === undefined) { continue } + if (program.payload === undefined) { continue } + if (program.payload[programPropertyName].isActive === false) { continue } - distributeProgram(userProfile.tokenPowerSwitch[programPropertyName]) + distributeProgram(program) } for (let i = 0; i < userProfiles.length; i++) { let userProfile = userProfiles[i] if (userProfile.tokenPowerSwitch === undefined) { continue } - if (userProfile.tokenPowerSwitch[programPropertyName] === undefined) { continue } - if (userProfile.tokenPowerSwitch[programPropertyName].payload === undefined) { continue } - if (userProfile.tokenPowerSwitch[programPropertyName].payload[programPropertyName].isActive === false) { continue } + let program = UI.projects.governance.utilities.validations.onlyOneProgram(userProfile, programNodeType) + if (program === undefined) { continue } + if (program.payload === undefined) { continue } + if (program.payload[programPropertyName].isActive === false) { continue } - calculateProgram(userProfile.tokenPowerSwitch[programPropertyName]) + calculateProgram(program) } function resetProgram(node) { @@ -77,17 +82,17 @@ function newFoundationsUtilitiesBonusProgram() { } } - function validateProgram(node) { + function validateProgram(node, userProfile) { /* This program is not going to run unless the Profile has Tokens, and for that users needs to execute the setup procedure of signing their Github username with their private key. */ if ( - node.payload.parentNode.payload.parentNode.payload.blockchainTokens === undefined + userProfile.payload.blockchainTokens === undefined ) { node.payload[programPropertyName].isActive = false - node.payload.parentNode.payload.parentNode.payload.uiObject.setErrorMessage("You need to setup this profile with the Profile Constructor, to access the Token Power of your account at the Blockchain.") + userProfile.payload.uiObject.setErrorMessage("You need to setup this profile with the Profile Constructor, to access the Token Power of your account at the Blockchain.") return } }