STEEMASK UPDATE: A decentralized question and answer website built on the STEEM Blockchain

in #utopian-io6 years ago (edited)

STEEMASK UPDATE: A decentralized question and answer website built on the STEEM Blockchain

What is the project about?

SteemAsk is a question and answer website that is been built to allow users ask both steem and non-steem related question while getting reply from other members of the community. Many steemit users especially newbies need guidance and most times they wish can get access to other members and ask question to help them be successful on steemit. SteemAsk provides the platform for this, and users can also search for questions to get quick answers. SteemAsk is the stackoverflow of the steem blockchain.

How does it work?

SteemAsk works exactly like every other question and answer forum, but on SteemAsk:

  • Users can upvote questions and answers they find really helpful.
  • Users can check payout for their and any other account
  • Users can trade Steem and SBD in the marketplace.

Previous Update

https://utopian.io/utopian-io/@profchydon/steemask-a-decentralized-question-and-answer-website-built-on-the-steem-blockchain

https://utopian.io/utopian-io/@profchydon/steemask-update-a-decentralized-question-and-answer-website-built-on-the-steem-blockchain

New Features

  • Users can now check both post, comment and total payout. This feature helps users keep track of their expected post, comment and total payout​

  • Profile page now available: Users can now view their profile on steemAsk profile page.

  • Users can now view post payout for other users just by entering the required username.

  • steemAsk about us details now available. Thanks to a contributor @princekelly.
    https://utopian.io/utopian-io/@princekelly/copywriting-for-steemask-about-us

  • steemAsk privacy policy details now available. Thanks to @edikanefanga for his contribution

How i implemented this

While User is logged in, it was easy to check for logged in user's payout by just sending the $_SESSION['username'] as a parameter to the function

public function getUserCommentData ($username)
{
  $query = urlencode('{"start_author":"'.$username.'", "limit": "100"}');
  $url = 'https://api.steemjs.com/get_discussions_by_comments?query='.$query;
  $json= file_get_contents($url);
  $data = json_decode($json,true);
  return $data;

}

Then, i called the getUserCommenData in another function to get User's comment payout.

public function payout ()
    {

      if (session_status () == PHP_SESSION_NONE) {
         session_start();
      }

      $username = $_SESSION['username'];

      $data['coinmarketcap'] = $this->coinmarketcap->getAllCoinDetails();
      $data['profile'] = $this->user->getUserBlogData($username);
      $data['comment'] = $this->user->getUserCommentData($username);

      return view ('pages.payout' , $data);

    }

To get post payout of user's not logged in, a username must be supplied and i made use of Laravel Route Model Binding Route::get('/payout/{username}', 'UsersController@notLoggedInPayout');

public function notLoggedInPayout ($username)
{

      $data['coinmarketcap'] = $this->coinmarketcap->getAllCoinDetails();
      $data['profile'] = $this->user->getUserBlogData($username);
      $data['comment'] = $this->user->getUserCommentData($username);

      return view ('pages.notloggedinpayout' , $data);

    }


public function payoutcheck ()
{

        if (isset($_POST['username'])) {

            return redirect("/payout/".$_POST['username']);

        }else {

            return redirect()->back();

        }

    }
<?php

     $total_price_comment = 0;
     $total_payout_in_sbd_comment = 0;
     $count_comment = 0;

     foreach ($comment as $key => $comment_data) {

        if( !($comment_data["pending_payout_value"] == "0.000 SBD")) {

          $price_comment = str_replace(" SBD", "", $comment_data["pending_payout_value"]);

          if (!empty($comment_data['beneficiaries'])) {

             $beneficiary_comment = $comment_data['beneficiaries'][0]['account'];
             $weight_comment = ($comment_data['beneficiaries'][0]["weight"]/10000);
             $price_after_beneficiary_deduction_comment  = $price_comment - ($price_comment * $weight_comment);
             $payout_in_sbd_comment  =  $price_after_beneficiary_deduction_comment * 0.375;
             $total_price_comment = $total_price_comment + $payout_in_sbd_comment;

          }else {

            $payout_in_sbd_comment  = $price_comment   * 0.375;
            $total_price_comment = $total_price_comment + $payout_in_sbd_comment;

          }

          $total_comment_payout_in_sbd = round($total_payout_in_sbd_comment + $payout_in_sbd_comment,2);
        }
      }
?>

<form class="form-group col-md-8 pull-right" action="/payoutcheck" method="post">

    {{ Csrf_field() }}

    <input class="form-control" type="text" name="username" value="" placeholder="Enter Username without @ to view for other users">

    <button class="btn btn-primary pull-right" type="submit" value="ok" name="check">Go</button>

</form>

Commits on github

Roadmap

  • Get all basic functionalities working

  • Release Alpha version for testing

  • Get all other functionalities working

  • Release beta version

  • Continuous maintenance and addition of features for better user experience

How to contribute

You can contact me on discord: @profchydon#3371



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Getting close to completion I guess. This is great work @profchydon

Yes @gloeze. Its getting close to the beta release

As a follower of @followforupvotes this post has been randomly selected and upvoted! Enjoy your upvote and have a great day!

Thanks for the contribution. It has been approved.

I would recommend not using the same title for every contribution about SteemAsk since it makes it difficult to distinguish between them!


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

[utopian-moderator]

Ok noted. Thanks

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 64010.25
ETH 3401.16
USDT 1.00
SBD 2.62