Show Protocoin total circulation
This commit is contained in:
parent
118a99aedd
commit
590b37c085
|
@ -214,6 +214,7 @@ class MemberSerializer(serializers.ModelSerializer):
|
||||||
email = fields.UserEmailField(serializers.EmailField)
|
email = fields.UserEmailField(serializers.EmailField)
|
||||||
phone = serializers.CharField()
|
phone = serializers.CharField()
|
||||||
protocoin = serializers.SerializerMethodField()
|
protocoin = serializers.SerializerMethodField()
|
||||||
|
total_protocoin = serializers.SerializerMethodField()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Member
|
model = models.Member
|
||||||
|
@ -257,6 +258,11 @@ class MemberSerializer(serializers.ModelSerializer):
|
||||||
total = transactions.aggregate(Sum('protocoin'))['protocoin__sum'] or 0
|
total = transactions.aggregate(Sum('protocoin'))['protocoin__sum'] or 0
|
||||||
return total
|
return total
|
||||||
|
|
||||||
|
def get_total_protocoin(self, obj):
|
||||||
|
transactions = models.Transaction.objects
|
||||||
|
total = transactions.aggregate(Sum('protocoin'))['protocoin__sum'] or 0
|
||||||
|
return total
|
||||||
|
|
||||||
def update(self, instance, validated_data):
|
def update(self, instance, validated_data):
|
||||||
instance.user.email = validated_data.get('email', instance.user.email)
|
instance.user.email = validated_data.get('email', instance.user.email)
|
||||||
instance.user.save()
|
instance.user.save()
|
||||||
|
|
|
@ -94,6 +94,8 @@ export function Paymaster(props) {
|
||||||
|
|
||||||
<p>Current balance: ₱ {user.member.protocoin.toFixed(2)}</p>
|
<p>Current balance: ₱ {user.member.protocoin.toFixed(2)}</p>
|
||||||
|
|
||||||
|
<p>Total circulation: ₱ {user.member.total_protocoin.toFixed(2)}</p>
|
||||||
|
|
||||||
<Grid stackable padded columns={2}>
|
<Grid stackable padded columns={2}>
|
||||||
<Grid.Column width={5}>
|
<Grid.Column width={5}>
|
||||||
Buy any amount of Protocoin:
|
Buy any amount of Protocoin:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user