Skip to content

Commit

Permalink
balance of other users gets data via user subscription model
Browse files Browse the repository at this point in the history
  • Loading branch information
santisiri committed Mar 30, 2018
1 parent d83f8f6 commit 247848a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion imports/ui/css/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ body {
}

.vote {
/* will-change: transform; */
will-change: transform;
}
1 change: 0 additions & 1 deletion imports/ui/templates/components/decision/liquid/liquid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
15 changes: 14 additions & 1 deletion imports/ui/templates/components/identity/card/card.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 247848a

Please sign in to comment.