fix off by 1 pledge sync issue
This commit is contained in:
parent
304082ff21
commit
b7b39205d2
|
@ -6,7 +6,7 @@ import { getProfilesById } from './profiles'
|
|||
const createPledge = (pledge, data, profiles) => {
|
||||
const { id, owner, amount, token, commitTime, nDelegates, pledgeState, intendedProject } = data
|
||||
const profile = profiles.find(p => p.idProfile == owner)
|
||||
pledge.pledgeId = id
|
||||
pledge.pledgeId = Number(id)
|
||||
pledge.owner = Number(owner)
|
||||
pledge.amount = amount
|
||||
pledge.token = token
|
||||
|
@ -36,7 +36,7 @@ export const batchAddPledges = async (pledges, profiles = []) => {
|
|||
const getLastPledge = pledges => {
|
||||
const pledgeId = pledges.length
|
||||
? pledges.sort((a,b) => b.pledgeId - a.pledgeId)[0].pledgeId
|
||||
: 1
|
||||
: 0
|
||||
return pledgeId
|
||||
}
|
||||
export const getAndAddPledges = async () => {
|
||||
|
|
|
@ -29,7 +29,7 @@ export default appSchema({
|
|||
tableSchema({
|
||||
name: 'pledges',
|
||||
columns: [
|
||||
{ name: 'pledge_id', type: 'number' },
|
||||
{ name: 'pledge_id', type: 'number', isIndexed: true },
|
||||
{ name: 'owner_id', type: 'number', isIndexed: true },
|
||||
{ name: 'amount', type: 'string' },
|
||||
{ name: 'token', type: 'string' },
|
||||
|
|
Loading…
Reference in New Issue