fix pledges profile relationship import

fix pledgeState type error
This commit is contained in:
Barry Gitarts 2019-02-14 09:41:26 -05:00 committed by Barry G
parent 8ae34629cc
commit c5b734b175
2 changed files with 5 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import { getProfilesById } from './profiles'
const createPledge = (pledge, data, profiles) => {
const { id, owner, amount, blockNumber, token, commitTime, nDelegates, pledgeState, intendedProject } = data
console.log({data})
const profile = profiles.find(p => p.idProfile == owner)
pledge.pledgeId = Number(id)
pledge.owner = Number(owner)
@ -13,7 +14,7 @@ const createPledge = (pledge, data, profiles) => {
pledge.token = token
pledge.commitTime = Number(commitTime)
pledge.nDelegates = Number(nDelegates)
pledge.pledgeState = pledgeState
pledge.pledgeState = Number(pledgeState)
pledge.intendedProject = Number(intendedProject)
pledge.blockNumber = Number(blockNumber)
pledge.profile.set(profile)

View File

@ -51,8 +51,10 @@ class App extends React.Component {
// not running in parallel due to possible metamask / infura limitation
await getAndAddLpEvents()
await getAndAddVaultEvents()
await getAndAddPledges()
// Profiles must be loaded before pledges to set profile on pledge model
await addFormattedProfiles()
await getAndAddPledges()
await updateStalePledges()
this.setState({ loading: false })
}