Merge pull request #1201 from Luis-Fernando-Molina/develop
Contribution: Voting Program next Iteration
This commit is contained in:
6 files changed
+26
-23
No files matched your search
@@ -308,7 +308,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
|
||||
case 'node': {
|
||||
let childNode = node[property.name]
|
||||
if (childNode === undefined) { continue }
|
||||
if (childNode.type === "Tokens Awarded") {continue}
|
||||
if (childNode.type === "Tokens Awarded") { continue }
|
||||
|
||||
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
|
||||
if (percentage !== undefined && isNaN(percentage) !== true) {
|
||||
@@ -324,7 +324,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
|
||||
for (let m = 0; m < propertyArray.length; m++) {
|
||||
let childNode = propertyArray[m]
|
||||
if (childNode === undefined) { continue }
|
||||
if (childNode.type === "Tokens Awarded") {continue}
|
||||
if (childNode.type === "Tokens Awarded") { continue }
|
||||
|
||||
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
|
||||
if (percentage !== undefined && isNaN(percentage) !== true) {
|
||||
@@ -352,7 +352,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
|
||||
case 'node': {
|
||||
let childNode = node[property.name]
|
||||
if (childNode === undefined) { continue }
|
||||
if (childNode.type === "Tokens Awarded") {continue}
|
||||
if (childNode.type === "Tokens Awarded") { continue }
|
||||
|
||||
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
|
||||
if (percentage === undefined || isNaN(percentage) === true) {
|
||||
@@ -367,7 +367,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
|
||||
for (let m = 0; m < propertyArray.length; m++) {
|
||||
let childNode = propertyArray[m]
|
||||
if (childNode === undefined) { continue }
|
||||
if (childNode.type === "Tokens Awarded") {continue}
|
||||
if (childNode.type === "Tokens Awarded") { continue }
|
||||
|
||||
let percentage = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(childNode.payload, 'percentage')
|
||||
if (percentage === undefined || isNaN(percentage) === true) {
|
||||
@@ -429,7 +429,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
|
||||
|
||||
function drawClaims(node) {
|
||||
let status =
|
||||
new Intl.NumberFormat().format(node.payload.claimsProgram.awarded.tokens) +
|
||||
parseFloat(node.payload.claimsProgram.awarded.tokens.toFixed(2)).toLocaleString('en') +
|
||||
' ' + 'SA Tokens Awarded' + ' - ' +
|
||||
'From Reward: ' + node.payload.claimsProgram.awarded.percentage.toFixed(2) + '%' + ' - ' +
|
||||
'Shared Between: ' + node.payload.claimsProgram.share.count + ' claims' + ' - ' +
|
||||
@@ -441,7 +441,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
|
||||
function drawProgram(node) {
|
||||
if (node.payload !== undefined) {
|
||||
|
||||
const ownPowerText = new Intl.NumberFormat().format(node.payload.claimsProgram.ownPower)
|
||||
const ownPowerText = parseFloat(node.payload.claimsProgram.ownPower.toFixed(2)).toLocaleString('en')
|
||||
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
@@ -453,7 +453,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
|
||||
function drawTokensAwarded(node) {
|
||||
if (node.tokensAwarded !== undefined && node.tokensAwarded.payload !== undefined) {
|
||||
|
||||
const tokensAwardedText = new Intl.NumberFormat().format(node.payload.claimsProgram.awarded.tokens)
|
||||
const tokensAwardedText = parseFloat(node.payload.claimsProgram.awarded.tokens.toFixed(2)).toLocaleString('en')
|
||||
|
||||
node.tokensAwarded.payload.uiObject.valueAngleOffset = 0
|
||||
node.tokensAwarded.payload.uiObject.valueAtAngle = false
|
||||
@@ -466,7 +466,7 @@ function newGovernanceFunctionLibraryClaimsProgram() {
|
||||
}
|
||||
|
||||
function drawProgramPower(node, programPower, percentage) {
|
||||
const programPowerText = new Intl.NumberFormat().format(programPower) + ' ' + 'Claim Power'
|
||||
const programPowerText = parseFloat(programPower).toLocaleString('en') + ' ' + 'Claim Power'
|
||||
if (node.payload !== undefined) {
|
||||
|
||||
node.payload.uiObject.valueAngleOffset = 180
|
||||
|
||||
@@ -155,7 +155,7 @@ function newGovernanceFunctionLibraryStackingProgram() {
|
||||
function drawProgram(node) {
|
||||
if (node.payload !== undefined) {
|
||||
|
||||
const ownPowerText = new Intl.NumberFormat().format(node.payload.stackingProgram.ownPower)
|
||||
const ownPowerText = parseFloat(node.payload.stackingProgram.ownPower.toFixed(2)).toLocaleString('en')
|
||||
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
@@ -164,7 +164,7 @@ function newGovernanceFunctionLibraryStackingProgram() {
|
||||
}
|
||||
if (node.tokensAwarded !== undefined && node.tokensAwarded.payload !== undefined) {
|
||||
|
||||
const tokensAwardedText = new Intl.NumberFormat().format(node.payload.stackingProgram.awarded.tokens)
|
||||
const tokensAwardedText = parseFloat(node.payload.stackingProgram.awarded.tokens.toFixed(2)).toLocaleString('en')
|
||||
|
||||
node.tokensAwarded.payload.uiObject.valueAngleOffset = 0
|
||||
node.tokensAwarded.payload.uiObject.valueAtAngle = false
|
||||
|
||||
@@ -78,19 +78,19 @@ function newGovernanceFunctionLibraryTokenPower() {
|
||||
/*
|
||||
Before we start we will do some validations:
|
||||
*/
|
||||
if (userProfile.tokenPowerSwitch === undefined) {
|
||||
if (userProfile.tokenPowerSwitch === undefined) {
|
||||
userProfile.payload.uiObject.setErrorMessage("You need to have a Token Power Switch child node.")
|
||||
return
|
||||
}
|
||||
if (userProfile.tokenPowerSwitch.referralProgram === undefined) {
|
||||
if (userProfile.tokenPowerSwitch.referralProgram === undefined) {
|
||||
userProfile.tokenPowerSwitch.payload.uiObject.setErrorMessage("You need to have a Referral Program child node.")
|
||||
return
|
||||
}
|
||||
if (userProfile.tokenPowerSwitch.mentorshipProgram === undefined) {
|
||||
if (userProfile.tokenPowerSwitch.mentorshipProgram === undefined) {
|
||||
userProfile.tokenPowerSwitch.payload.uiObject.setErrorMessage("You need to have a Mentorship Program child node.")
|
||||
return
|
||||
}
|
||||
if (userProfile.tokenPowerSwitch.supportProgram === undefined) {
|
||||
if (userProfile.tokenPowerSwitch.supportProgram === undefined) {
|
||||
userProfile.tokenPowerSwitch.payload.uiObject.setErrorMessage("You need to have a Spupport Program child node.")
|
||||
return
|
||||
}
|
||||
@@ -229,7 +229,7 @@ function newGovernanceFunctionLibraryTokenPower() {
|
||||
}
|
||||
|
||||
function drawTokenPower(node, tokenPower, percentage) {
|
||||
tokenPower = new Intl.NumberFormat().format(tokenPower) + ' ' + 'Token Power'
|
||||
tokenPower = parseFloat(tokenPower.toFixed(2)).toLocaleString('en') + ' ' + 'Token Power'
|
||||
if (node.payload !== undefined) {
|
||||
if (node.type === 'User Profile') {
|
||||
return
|
||||
|
||||
@@ -164,11 +164,14 @@ function newGovernanceFunctionLibraryTokens() {
|
||||
}
|
||||
|
||||
function drawTokenFlow(node, tokens, weight) {
|
||||
if (tokens.toFixed === undefined) { return }
|
||||
let status
|
||||
if (weight !== undefined && weight !== 0) {
|
||||
status = new Intl.NumberFormat().format(tokens) + ' ' + 'SA Tokens Reward' + ' - ' + 'Weight: ' + weight.toFixed(2)
|
||||
status = parseFloat(tokens.toFixed(2)).toLocaleString('en')
|
||||
+ ' ' + 'SA Tokens Reward' + ' - ' + 'Weight: ' + weight.toFixed(2)
|
||||
} else {
|
||||
status = new Intl.NumberFormat().format(tokens) + ' ' + 'SA Tokens Reward'
|
||||
status = parseFloat(tokens.toFixed(2)).toLocaleString('en')
|
||||
+ ' ' + 'SA Tokens Reward'
|
||||
}
|
||||
|
||||
if (node.payload !== undefined) {
|
||||
|
||||
@@ -266,7 +266,7 @@ function newGovernanceFunctionLibraryVotes() {
|
||||
}
|
||||
|
||||
function drawVotes(node, votes, percentage) {
|
||||
votes = new Intl.NumberFormat().format(votes) + ' ' + 'Votes'
|
||||
votes = parseFloat(votes.toFixed(2)).toLocaleString('en') + ' ' + 'Votes'
|
||||
if (node.payload !== undefined) {
|
||||
|
||||
if (node.type === 'Voting Program') {
|
||||
|
||||
@@ -316,7 +316,7 @@ function newFoundationsUtilitiesMandatoryProgram() {
|
||||
function drawUserNode(node, percentage) {
|
||||
if (node.payload !== undefined) {
|
||||
|
||||
const outgoingPowerText = new Intl.NumberFormat().format(node.payload[programPropertyName].outgoingPower)
|
||||
const outgoingPowerText = parseFloat(node.payload[programPropertyName].outgoingPower.toFixed(2)).toLocaleString('en')
|
||||
|
||||
node.payload.uiObject.valueAngleOffset = 180
|
||||
node.payload.uiObject.valueAtAngle = true
|
||||
@@ -338,17 +338,17 @@ function newFoundationsUtilitiesMandatoryProgram() {
|
||||
function drawProgram(node) {
|
||||
if (node.payload !== undefined) {
|
||||
|
||||
const ownPowerText = new Intl.NumberFormat().format(node.payload[programPropertyName].ownPower)
|
||||
const incomingPowerText = new Intl.NumberFormat().format(node.payload[programPropertyName].incomingPower)
|
||||
const ownPowerText = parseFloat(node.payload[programPropertyName].ownPower.toFixed(2)).toLocaleString('en')
|
||||
const incomingPowerText = parseFloat(node.payload[programPropertyName].incomingPower.toFixed(2)).toLocaleString('en')
|
||||
|
||||
node.payload.uiObject.statusAngleOffset = 0
|
||||
node.payload.uiObject.statusAtAngle = false
|
||||
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Own Power - ' + incomingPowerText + ' Incoming Power')
|
||||
node.payload.uiObject.setStatus(ownPowerText + ' Own ' + programPowerName + ' - ' + incomingPowerText + ' Incoming ' + programPowerName + '')
|
||||
}
|
||||
if (node.tokensAwarded !== undefined && node.tokensAwarded.payload !== undefined) {
|
||||
|
||||
const tokensAwardedText = new Intl.NumberFormat().format(node.payload[programPropertyName].awarded.tokens)
|
||||
const tokensAwardedText = parseFloat(node.payload[programPropertyName].awarded.tokens.toFixed(2)).toLocaleString('en')
|
||||
|
||||
node.tokensAwarded.payload.uiObject.statusAngleOffset = 0
|
||||
node.tokensAwarded.payload.uiObject.statusAtAngle = false
|
||||
|
||||
Reference in new issue
Block a user