[Accusta for Steemit] More information about Benefactor rewards (v1.0.0 update)

in #utopian-io7 years ago (edited)

Repository

https://github.com/semasping/Accusta

In 1.0.0 release of accusta_logo_line_170.png:

  • Add information about Benefactor rewards.
  • New structure for pages with rewards with charts and ajax data loading.
  • Bugfixes

Detailed information

New Features

In this release, I started adding charts so let’s look at the example of beneficiary reward to see reward pages form.

In the current release, I also added on-demand data download to the tables. Now it is possible to show data over all the time of the account exists.

How receiving beneficial rewards are implemented:

So far as all accounts’ data is stored in the MongoDB we can get all operations of the type:
comment_benefactor_reward

As there are cases when we need to handle a lot of data so I solved that the data for charts will be collected using the DB by the following request:

$data_by_monthes = $collection->aggregate([
    [
        '$match' => [
            'type' => ['$eq' => 'comment_benefactor_reward'],
            'op.benefactor' => ['$eq' => $acc]
        ]
    ],
    ['$unwind' => '$op'],
    [
        '$group' => [
            '_id' => ['date' => ['M' => ['$month' => '$date'], 'Y' => ['$year' => '$date'],]],
            'total' => ['$sum' => '$op.VESTS'],
            'count' => ['$sum' => 1]
        ]
    ],
]);

We have two reward types:
those which are received by the account 'op.benefactor' => ['$eq' => $acc]
those which are given out by the account (i.e.from its posts) 'op.benefactor' => ['$ne' => $acc]

Data sampling for this kind of tables are proceeded by the request:

$data_by_monthes = $collection->aggregate([
    [
        '$match' => [
            'date' => ['$gte' => $date_start, '$lt' => $date_end],
            'type' => ['$eq' => 'comment_benefactor_reward'],
            'op.benefactor' => [$typeQ => $acc]
        ]
    ]
]);

So we get monthly data, then handle them in foreach and convert them into desirable form.

foreach ($data_by_monthes as $state) {
   
    if ($type == 'In') {
        $arr['author'] = $state['op'][1]['author'];
    }
    if ($type == 'Out') {
        $arr['author'] = $state['op'][1]['benefactor'];
    }

    $arr['permlink'] = $state['op'][1]['permlink'];
    $arr['VESTS'] = $state['op'][1]['VESTS'];
    $arr['SP'] = BchApi::convertToSg($state['op'][1]['VESTS']);
    $arr['timestamp'] = $state['timestamp'];
    $res_arr[] = $arr;
}

See more details here: app/Http/Controllers/BenefactorRewardsController.php

Bugfixes

Besides each release contains changes for data transfer from blockchain to the DB. I can’t find an error-free way so far. Any sort of bugs occurs all the time :(

I suppose it's needed to move on to the separate library for work with DB and to implement a full-value initial collection of data from blocks.

Commits in this release:

screenshot-github.com 2018.05.17 19-39-35.png
[update] readme semasping 17.05.2018 19:17
[update] benefactor code [update] readme semasping 17.05.2018 18:27
[update] information about out rewards by month semasping 15.05.2018 18:27
[add] information about out rewards by month semasping 15.05.2018 16:46
[add] information about out rewards by month semasping 15.05.2018 16:45
[update] benefactor rewards [add] information about rewards by month [add] sort in table for rewards semasping 15.05.2018 11:45
[update] for php client semasping 15.05.2018 2:26
[update] loading transactions semasping 10.05.2018 12:44
[update] composer semasping 10.05.2018 12:28
[update] notify failed load transactions jobs semasping 10.05.2018 4:24
[bugfix] add exception semasping 10.05.2018 4:17
[bugfix] add exception semasping 10.05.2018 4:15
[bugfix] add exception semasping 10.05.2018 4:14
[bugfix] add exception semasping 10.05.2018 4:11
[bugfix] add exception semasping 10.05.2018 4:07
[bugfix] remove echo laravel version semasping 10.05.2018 4:06
[update] notify about failed jobs in trnasactions semasping 10.05.2018 4:03
[update] transation count in DB semasping 08.05.2018 3:29
[update] benefactorRewards statistics [Add] more info semasping 08.05.2018 2:55
[update] benefactorRewards statistics [Add] more info semasping 08.05.2018 2:53
[update] benefactorRewards statistics semasping 08.05.2018 2:32
[new] benefactorRewards statistics semasping 08.05.2018 2:19
[update] PowerDown info from mongoDB semasping 03.05.2018 4:01
[bugfix] footer on steemit part semasping 03.05.2018 4:01
[bugfix] link and logo on witness votes page semasping 03.05.2018 3:49
[update] footer for steemit semasping 30.04.2018 14:07

This release it is the beginning of new development stage of the Accusta system.

Redesign of curation rewards will be next in line for development, i.e.:

  • transferring to a separate page
  • charts adding

GitHub Account

https://github.com/semasping

Sort:  

Thanks for the contribution!

The benefactor rewards chart is very interesting! What determines which dates are shown? I checked @utopian-io for example, and it only shows data for 2017 Oct, 2017 Dec and 2018 May. It would be really cool if it was possible to see more months than that.

I am really happy you included a screenshot showing which commits are included in this release! However, keep in mind that only commits that are 14 days old or less at the time of submitting are eligible. Also, it would be nice if you'd create a PR with all the relevant commits, which makes it easier for us to have an overview of the changes, but of course this isn't required.

Click here to see how your contribution was evaluated.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thanks for approving.

For @utopian.pay there is more month https://steemit.accusta.tk/@utopian.pay/benefactor

For @utopian-io I can see late evening, why only shows data for 2017 Oct, 2017 Dec and 2018 May.

Commits that late 14 days contains bugfixes, not so important. Included just for statistics. :)

Cool! I think it's because there simply weren't any beneficiaries set in other months (forgot that they used @utopian.pay for that), so it makes sense, thanks.

Hey @semasping
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.26
TRX 0.20
JST 0.038
BTC 95804.23
ETH 3607.03
USDT 1.00
SBD 3.79