SteemFlagRewards Project Update: Code Review - Prepping for SFR Credits

5개월 전

I have conducted a code review of the SFR bot. This will pave the way for future improvements and innovations. The foremost being the SFR credit system via our newly created Steem-Engine token.


1. Moved all rank-related lists to the config file.

     This included both mod and flagger ranks. This part of the report adds a nice visual element to what we do. I do imagine I will use these ranks for future role playing games. Let's just say I have a few ideas up my sleeve.

Mod Ranks

2. Updated Flagger Beneficiary Report Verbage

...Flaggers have been designated as post beneficiaries. Our goal is to empower abuse fighting plankton and minnows Steemians and promote a Steem platform that is less-friendly to abuse. It is simple. Building abuse fighters equals less abuse.

3. Redesigned Flaggable Post Query

     It now displays all flagged content that is less than 5 days old. This helps us to focus our voting power where it is most effective and avoid the late voting penalty. The entire query for flaggable posts is below. If you have any ideas, feel free to drop a comment.

    sql_flaggable = cursor.execute( #Queries obtains flagged posts within the 5 day mark for report includsion and action
        "SELECT DISTINCT CASE WHEN category LIKE '%nsfw%' OR category LIKE '%porn spam%' THEN '[NSFW link](' || post || '#' || comment || ')' " \
        "ELSE '[Comment](\' || post || '#' || comment || ')' END, '@' || approved_by, category, post, comment, " \
        "CASE WHEN category LIKE '%nsfw%' OR category LIKE '%porn spam%' THEN '[NSFW link](' || post || ')' " \
        "ELSE '[Comment](\' || post || ')' END " \
        "FROM steemflagrewards WHERE created > DATETIME(\'now\', \'-5 days\')")

4. Added batch method for mods to approve follow ons.

     This function allows to submit all child mentions for approval in batch. This greatly improved the amount of time it takes when a mod finds a post that has many flag mentions. It's a great timesaver so we can focus more on abuse fighting and related development. The downside is it has a tendency to affect the accounting of approvals. This is because we now track in two channels.

5. Insert Mention Function

     To condense our code, we have eliminated the repetion of database inserts. These inserts occur throughout our approval workflows. This was achieved by standardazing the queries. We took hard coded boolean values (True of False) and passed the variable as a parameter of said function. The greatly improves the readability of the code not to mention the amount of lines.

6. Export SFR Database to CSV function

     This function exports the SFR database as a comma separated values file. This allows performance of various types of analytics. The function was recently used to provide @imacryptorick with our flag data used in his recent SFR flag trail tutorial. I highly recommend giving it a look to better understand. It breaks it down quite well.

Summary of Code Review

  • 334 lines of code added or updated
  • 56 lines of code trimmed
  • 5 functions added
  • 1 DB Query updated

     This code review will help us prepare for the migration to the SFR credit system, a extensive undertaking in its own right. The DRY ("Don't Repeat Yourself") changes will ensure I only have to update the main bot code in 1 place instead of 7. If we ever need to add a column, this will reduce the time cost and chance for human error.

Because even though I am technically a cyborg, I still make mistakes.

     These things will help pave the wave for the implementation of the SFR credit system. On that note, I have developed about 50% of the functionality required which have been mentioned at greater length in this comment.

Links to all GitHub commits:

Moved all rank-related lists to the config file.
Updated Flagger Beneficiary Report Verbage
Redesigned Flaggable Post Query
Batch Follow On Approval
Insert Mention Function - DRY Principle
Updated Flag LeaderBoard / Added Mod Leaderboard
Removed extraneous variables from main script
export_sfr_db function / add paid column to db

Thanks for all that believe in and support the work we are completing together for this chain.

     It has taken a lot of time and effort for us to get this far and appreciate the community support / good vibes. I'm glad to add value to something that bolsters abuse fighting capability on chain. Like to think of what we do as force-multiplier of the stake we have assembled together as a community.

We can affect much greater change when we coordinate our efforts and our Steem Power together.

Would you like to delegate to the Steem Flag Rewards project and promote decentralized moderation?

It's much more fashionable than self-voting.

Here are some handy delegation links!

50 SP 100 SP 500 SP 1000 SP

New Supporter Incentives Coming!

I will be providing increased flag incentives to those that:

     This will improve our support and flag capabilities. It is NOT a requirement but will be a perk for those willing to support. Furthermore, I will be working flagger / delegator incentives into the @steemflagrewards upvote algorithm. Stay Tuned.

Note: The primary incentive is reducing the profitability of abuse platform wide. This benefits all users of the Steem blockchain so please consider support.

Also, here is my SteemAuto fanbase link if you would like to be one of my consistent supporters.

Series Backlinks

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  trending

Magic Dice has rewarded your post with a 73% upvote. Thanks for playing Magic Dice.

Hi Anthony,
Every now and then, a code review is necessary. And since it's spring time in the US, spring cleaning is bound to happen.

Moving some things to the config file is a good move. It might be ok to move the report verbiage to the config file too...

Overall, SFR inner-workings are progressing. The less repetitive the code is, the easier is the maintenance.

Good luck on the SFR credits token!

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.

Need help? Chat with us on Discord.



Thank you for your review, @lovenfreedom! Keep up the good work!

Soon...@steemflagrewards shall evolve into the next level.

Hey, @anthonyadavisii!

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

Get higher incentives and support!
Simply set as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord

Vote for Utopian Witness!

I hear congratulations are in order. Hope all is well :)

Hi @anthonyadavisii!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hi, @anthonyadavisii!

You just got a 14.08% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.