Utopian Moderator Chrome Extension: Improved Supervisor Tab by Showing Acceptance Rate and Pie Chart


Utopian Chrome Extension for Moderator

This is a handy Chrome Extension that is made exclusively for Utopian Moderators and Supervisors. It aims to provide as much useful tools and data as possible regarding to the Utopian moderation.

v0.0.7 New Feature

Along with some bug fixes and code refactoring, this commit improves the supervisor tab by adding Acceptance Rate and Pie Chart.

utopian-chrome-extension-accept-rate-pie-chart Utopian Moderator Chrome Extension: Improved Supervisor Tab by Showing Acceptance Rate and Pie Chart

utopian-chrome-extension-accept-rate-pie-chart

Previous Contributions

Technology Stack

Javascript that runs in Chrome.

Github

https://github.com/DoctorLai/utopian-moderator

Javascript Async and Await

There is no direct API available to get the ratio by all moderators, but it is simple to achieve this by wrapping the API in Javascript async/await syntax.

// return the total number for status posts
const getModeratedCount = (id, status) => {
    return new Promise((resolve, reject) => {
        let api = "https://api.utopian.io/api/posts/?moderator=" + id + "&status=" + status + "&skip=0&limit=1";    
        fetch(api, {mode: 'cors'}).then(validateResponse).then(readResponseAsJSON).then(function(result) {
            resolve(result.total);
        });        
    });
}

// async get two numbers
const getRatio = async(id) => {
    let accepted = await getModeratedCount(id, "reviewed");
    let rejected = await getModeratedCount(id, "flagged");
    return accepted / (accepted + rejected) * 100;
}

To update the fields in the table, use something like this:

getRatio("justyy").then(r => {
    if (r <= 60) {
        $('div#approved_ratio_' + _tid).html("<B><font color=green>" + r.toFixed(2) + "</font></B>");
    } else if (r <= 80) {
        $('div#approved_ratio_' + _tid).html("<B><font color=orange>" + r.toFixed(2) + "</font></B>");
    } else {
        $('div#approved_ratio_' + _tid).html("<B><font color=red>" + r.toFixed(2) + "</font></B>");
    }
});

Roadmap of Utopian Moderators & Supervisors

This project is on fire!

  1. Add more handy tools/features regarding to the post.
  2. Add more global statistics.
  3. Add some real time statistics.

Chrome Webstore

Install the Utopian Chrome Extension Now!

Contribution Welcome

Github: https://github.com/DoctorLai/utopian-moderator

  • Fork it!
  • Create your feature branch: git checkout -b my-new-feature
  • Commit your changes: git commit -am ‘Add some feature’
  • Push to the branch: git push origin my-new-feature
  • Submit a pull request.

–EOF (The Ultimate Computing & Technology Blog) —

625 words
Last Post: Adding Supervisor Tab to Utopian Moderator Chrome Extension!
Next Post: Make Utopian Moderator Chrome Extension Perfect by Adding Posts and Tools Tab

The Permanent URL is: Utopian Moderator Chrome Extension: Improved Supervisor Tab by Showing Acceptance Rate and Pie Chart (AMP Version)

Leave a Reply