Python Beem Blurt Project #5 - Working on Delegation by tomoyan

View this thread on steempeak.com
· @tomoyan ·
$7.62
Python Beem Blurt Project #5 - Working on Delegation
![the_art_of_delegation1200x600.png](https://images.ecency.com/DQmQYh3L9gdhHpWtPkrkvgMt5miEj2zjQRjLcD7uDNyoJMY/the_art_of_delegation1200x600.png)

I started working on Blurt delegation with beem.
Plan is to display
* incoming delegations: where they are coming from
![in.png](https://images.ecency.com/DQmZSBE7vfokrKBFpgibRrJgXJsimrTN3sTDjozZ4orADC3/in.png)

* outgoing delegations: where they are going to
![out.png](https://images.ecency.com/DQmP9dS86tsxWdmwSuzsGAm5L9jArLQuoqKpd4JTTgHzvES/out.png)

* expiring delegations: when delegations expire (since it takes 5 days)
![exp.png](https://images.ecency.com/DQmZsHrkxxLiQnEYEwe3JzoZy4Q5JVosFgQb9qUUiCqHMiu/exp.png)

Main part is done like this to get all 3 delegation data
```
    def get_delegation(self):
        # find delegations for username
        data = {}

        if self.username:
            # find outgoing delegatons
            data['outgoing'] = self.account.get_vesting_delegations()
            for value in data['outgoing']:
                # vests to BP conversion
                # vests = Amount(value['vesting_shares'])
                # bp = self.blurt.vests_to_bp(vests.amount)
                # value['bp'] = f'{bp:.3f}'
                value['bp'] = self.vests_to_bp(value['vesting_shares'])

            # find expiring delegatons
            data['expiring'] = self.account.get_expiring_vesting_delegations()
            for value in data['expiring']:
                # vests to BP conversion
                # vests = Amount(value['vesting_shares'])
                # bp = self.blurt.vests_to_bp(vests.amount)
                # value['bp'] = f'{bp:.3f}'
                value['bp'] = self.vests_to_bp(value['vesting_shares'])

            # find incoming delegatons
            data['incoming'] = []
            incoming_temp = dict()
            for operation in self.account.history(
                    only_ops=["delegate_vesting_shares"]):

                if self.username == operation["delegator"]:
                    continue

                if operation["vesting_shares"] == '0.000000 VESTS':
                    incoming_temp.pop(operation["delegator"])
                    continue
                else:
                    incoming_temp[operation["delegator"]] = operation

            for key, value in incoming_temp.items():
                value['bp'] = self.vests_to_bp(value['vesting_shares'])
                data['incoming'].append(value)

        return data

    def vests_to_bp(self, vests):
        # VESTS to BP conversion
        bp = 0.000
        v = Amount(vests)
        bp = self.blurt.vests_to_bp(v.amount)
        bp = f'{bp:.3f}'

        return bp
```

I think backend is working, but frontend for this is not done... 😂 

Every time I work on frontend, I get distracted and feel like I want to change something, but design takes a looong time for me. It is very exausting.
So just added a bear.
![ezgif.com_gif_maker.gif](https://images.ecency.com/DQmY5E9e9qv7P2ACdr6Vy9s16DkDc7mbiALyXQY5tjx8QPZ/ezgif.com_gif_maker.gif)
I think I like it like that for now...
<center>
    [Get Rewarded For Browsing! Are you Brave?](https://brave.com/tom490)
    [<img src="https://img.esteem.app/be00j8.png">](https://brave.com/tom490)
    [![happy tears](https://images.ecency.com/DQmUfaVp5UQvASdTyyLrNiBdGB7NxQfxE2wBpNivcDUkCfe/h.gif)](https://tomoyan.github.io/)
    ➡️ [Website](https://tomoyan.github.io)
    ➡️ [Twitter ](https://twitter.com/tomoyanTweet)
</center>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
post_id88,096,043
authortomoyan
permlinkpython-beem-blurt-project-5-working-on-delegation
categoryprogramming
json_metadata{"tags":["programming","python","beem","blurt","mini","marlians","dblog"],"image":["https:\/\/images.ecency.com\/DQmQYh3L9gdhHpWtPkrkvgMt5miEj2zjQRjLcD7uDNyoJMY\/the_art_of_delegation1200x600.png","https:\/\/images.ecency.com\/DQmZSBE7vfokrKBFpgibRrJgXJsimrTN3sTDjozZ4orADC3\/in.png","https:\/\/images.ecency.com\/DQmP9dS86tsxWdmwSuzsGAm5L9jArLQuoqKpd4JTTgHzvES\/out.png","https:\/\/images.ecency.com\/DQmZsHrkxxLiQnEYEwe3JzoZy4Q5JVosFgQb9qUUiCqHMiu\/exp.png","https:\/\/images.ecency.com\/DQmY5E9e9qv7P2ACdr6Vy9s16DkDc7mbiALyXQY5tjx8QPZ\/ezgif.com_gif_maker.gif","https:\/\/img.esteem.app\/be00j8.png","https:\/\/images.ecency.com\/DQmUfaVp5UQvASdTyyLrNiBdGB7NxQfxE2wBpNivcDUkCfe\/h.gif"],"links":["https:\/\/brave.com\/tom490","https:\/\/tomoyan.github.io\/","https:\/\/tomoyan.github.io","https:\/\/twitter.com\/tomoyanTweet"],"app":"steemit\/0.2","format":"markdown"}
created2020-10-20 14:35:27
last_update2020-10-20 14:35:27
depth0
children5
net_rshares22,718,064,873,833
last_payout2020-10-27 14:35:27
cashout_time1969-12-31 23:59:59
total_payout_value4.062 SBD
curator_payout_value3.554 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length3,475
author_reputation866,518,377,346,806
root_title"Python Beem Blurt Project #5 - Working on Delegation"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (54)
@alexbalan ·
This is turning into an extremely useful dapp
👍  
properties (23)
post_id88,109,515
authoralexbalan
permlinkqijxtf
categoryprogramming
json_metadata{"app":"steemit\/0.2"}
created2020-10-21 12:39:18
last_update2020-10-21 12:39:18
depth1
children4
net_rshares39,081,901,367
last_payout2020-10-28 12:39:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length45
author_reputation1,881,241,039,849
root_title"Python Beem Blurt Project #5 - Working on Delegation"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@tomoyan ·
😳😳😳 idk... 
I am like using like jquery and stuff that is old 😬
I need to modernize it and still a long way to go 🙄
👍  
properties (23)
post_id88,111,852
authortomoyan
permlinkqik5hj
categoryprogramming
json_metadata{"app":"steemit\/0.2"}
created2020-10-21 15:24:57
last_update2020-10-21 15:24:57
depth2
children3
net_rshares1,130,772,460
last_payout2020-10-28 15:24:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length115
author_reputation866,518,377,346,806
root_title"Python Beem Blurt Project #5 - Working on Delegation"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@alexbalan ·
After all, what works, works. I like using php on my backends, but let's keep that a secret mkay?😂
👍  
properties (23)
post_id88,116,939
authoralexbalan
permlinkqikmho
categoryprogramming
json_metadata{"app":"steemit\/0.2"}
created2020-10-21 21:32:15
last_update2020-10-21 21:32:15
depth3
children2
net_rshares41,467,382,595
last_payout2020-10-28 21:32:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length98
author_reputation1,881,241,039,849
root_title"Python Beem Blurt Project #5 - Working on Delegation"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)