From 247848a1c6db43adaf669a79ed888c3ac0a34009 Mon Sep 17 00:00:00 2001 From: Santiago Siri Date: Fri, 30 Mar 2018 17:58:19 -0400 Subject: [PATCH] balance of other users gets data via user subscription model --- imports/ui/css/extra.css | 2 +- .../components/decision/liquid/liquid.js | 1 - .../ui/templates/components/identity/card/card.js | 15 ++++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/imports/ui/css/extra.css b/imports/ui/css/extra.css index de815c872..189e0ea2f 100644 --- a/imports/ui/css/extra.css +++ b/imports/ui/css/extra.css @@ -80,5 +80,5 @@ body { } .vote { - /* will-change: transform; */ + will-change: transform; } diff --git a/imports/ui/templates/components/decision/liquid/liquid.js b/imports/ui/templates/components/decision/liquid/liquid.js index c5e0be095..2385a6d69 100644 --- a/imports/ui/templates/components/decision/liquid/liquid.js +++ b/imports/ui/templates/components/decision/liquid/liquid.js @@ -196,7 +196,6 @@ Template.liquid.helpers({ return Template.instance().rightToVote.get(); }, minimumReached() { - console.log(Session.get(this._id)); return ((Session.get(this._id).allocateQuantity <= Session.get(this._id).minVotes) && Session.get(this._id).inBallot > 0); }, confirmationRequired() { diff --git a/imports/ui/templates/components/identity/card/card.js b/imports/ui/templates/components/identity/card/card.js index 99bc317e3..016b9bb63 100644 --- a/imports/ui/templates/components/identity/card/card.js +++ b/imports/ui/templates/components/identity/card/card.js @@ -1,5 +1,6 @@ import { Meteor } from 'meteor/meteor'; import { Template } from 'meteor/templating'; +import { Session } from 'meteor/session'; import { ReactiveVar } from 'meteor/reactive-var'; import { getDelegationContract } from '/imports/startup/both/modules/Contract'; @@ -61,15 +62,27 @@ Template.card.helpers({ profile() { let id; const userId = this.toString(); + const userWallet = Meteor.users.findOne({ _id: userId }).profile.wallet; if (userId === Meteor.userId()) { id = 'vote-user-balance'; } else { id = `vote-user-balance-${userId}`; + const cacheWallet = Session.get(id); + if (cacheWallet) { + console.log(Session.get(id)); + console.log(userWallet); + if (cacheWallet.available !== userWallet.available) { + cacheWallet.available = userWallet.available; + cacheWallet.balance = userWallet.balance; + cacheWallet.placed = userWallet.placed; + Session.set(id, cacheWallet); + } + } } return { balanceId: id, targetId: userId, - wallet: Meteor.users.findOne({ _id: userId }).profile.wallet, + wallet: userWallet, }; }, spinnerId() {