[Aristotle App] Add Contribution, Weekly LM Reports and more...

in utopian-io •  6 years ago  (edited)

Repository

https://github.com/dimitrisp2/AristotleApp

About Aristotle App

Aristotle App will help the translation teams of @utopian-io have a more uniformed and centralised method to keep track of their progress and tasks. Most of the teams are using spreadsheets to manage their work, but if such spreadsheets are not properly managed, they can become a burden instead of a help (I know as I'm part of the Greek Translations Team).

It was originally created to help the Greek Team's activities in the Translation category, as well as managing the community account @aristotle.team.


Overview

In the past week some major work was done on the project. In 16 commits since the previous post, the major additions were the "Weekly Reports" section and the "Add contribution" form.

I also implemented a couple of changes, as suggested by @codingdefined in his previous review.I didn't to implement all of @codingdefined suggestions due to lack of time, as I was super busy the past week, but I'll do so as soon as possible.

Let's have a look on the most important things I've done in the app in the past week (as with the previous contribution post, I am marking each addition/change on the project with the respective commits on Github. Some commits may not be found here, as the post is very big for my taste and/or they are not worthy of mention.)


Add new Contribution Post routine

In several commits over the week, I've implemented the following routine to add a contribution to the database. Let's see how it works:

The user clicks on the "Add Contribution" link, and a modal window appears and asks for a Steemit.com link

As soon as the user presses "Submit", the app is fetching a few details from the Blockchain and shows a confirmation form to make sure all details are correct. There is also a check for duplicate submission to the DB, so if someone tries to add a contribution that was already in the DB, an error message should appear.

If the user confirms that all details are correct, the contribution post is added to the database.

The confirmation form (and therefore, the addition to the database) only happens if the post author has a valid TR/LM role in the team, as defined in the App's database. If they don't have access, the app returns an error message and stops the routine there.

Related commits: [ae6f721], [27bbb49], [f699b48], [37faa81], [d27c2f9]


Weekly Reports

As Language Moderators, we have to fill out a weekly report for the contributions we've reviewed, that contains various messages for each contribution, as well as for the week overall. I've talked with @rosatravels about this and since it's not 100% sure it will be used by everyone, the final implementation will also include a spreadsheet generated by the app, that will be updated regularly, to make sure that we won't disrupt the way things work so far

However, since we also want to go back from time to time and check out how the translators are doing etc, I've started implementing it in the same manner the contributions are handled in the App.

The only things that are working right now, are the weekly report list and single report viewing.

This is the Single Report view. There are empty fields as they contain sensitive data and they are not supposed to be seen in public. Some notes on this view:

  • the "Project" field will contain the actual translation part number when we everything is imported correctly to the DB.
  • The red "X" in the "Submit" column, means the post hasn't been upvoted by @utopian-io. If it was voted, it would turn to a Green checkmark.
  • The last column will have actions, to edit the part number, comment, wordcount & score.

Related commits: [51391ff], [3e05f30], [15a8032], [c26be19], [f73a08d]


Other fixes/changes

Function GetUsername()

There was already a function to get a user's ID in the database, from their username. However, we also need the opposite (get a username from an ID).

I implemented GetUsername() that accepts one parameter, an integer number, that will be used to quickly find out the corresponding username.

Related commit: [f73a08d]

Fix and add more parameters to GetContributionList()

GetContributionList() was changed twice in the past week, in order to be used in a more broad manner. The previous function declaration was:

function GetContributionList($user = NULL, $project = NULL, $from = NULL, $to = NULL, $voted = NULL, $reviewed = NULL, $title = NULL){...}

And the current function declaration is:

function GetContributionList($user = NULL, $project = NULL, $from = NULL, $to = NULL, $voted = NULL, $reviewed = NULL, $proofreader = NULL, $title = NULL, $weeklyreport = NULL){...}

By setting the parameters of "proofreader" and "weeklyreport" to the respective needed values, the table will show the score/wordcount/contribution comment as well. If the declaration gets bigger (with more parameters), I'll probably modify it to accept one single parameter (which would be an array) and parse it inside the function as it is already ridiculously long! For example, if I wanted to get a weekly report's contribution list, I would call it as

$contributions = GetContributionList(NULL, NULL, $weekstart, $weekend, NULL, NULL, $proofreader, NULL, true);

Also a bug was fixed on GetContributionList() that wouldn't show the list if 2 or more fields were filled on the Contribution "Filter Results" form.

Related commits: [84ce88e], [f73a08d]

Menu Reworked & Bug fix

The Menu now has some kind of ACL, that will show links depending on the actual level of access of each user. There was also a bug that would show many error messages on the main page and the menu if no user was logged-in. This happened with a change in the code, while implementing the GetMainPageContent() and GetMenu() in the past.

Related commits: [3e05f30], [820df65]

Combining of IFs

As @codingdefined (whom I can't thank enough for his great reviews so far) noted in his previous review, fewer IFs/ELSEs could be used in certain functions. I only got to implement this on GetMenu() and GetMainPageContent(), but I'll get on the others in the coming days!

Related commit: [23eca0d]


Fixes/To Do in the next few days

Among other things, these are the things I want to do as soon as possible.

  • The "Add Contribution" form, needs a better way to check the contribution links. If a user tries to add a contribution with "www.steemit.com", instead of "steemit.com" as the domain, as well as use "http" instead of "https", the duplicate check won't work
  • Pages need an actual ACL check. Right now, if a user knows the URL of a page, they can navigate to it manually and see everything
  • Add forms to submit the weekly report's and each contribution's comment

Previous updates/reports:

  1. An app to supplement the Utopian Translation Teamwork [2018-10-15]
  2. Dynamic NavBar, Contributions List, Project View page, and more... [2018-10-22]

How to contribute?

You can find me on Utopian's discord if you want to talk. You can also open a pull request on github if you have something to add/fix.

Before opening a pull request, please have a look on the project's README.md.

GitHub Account

https://github.com/dimitrisp2

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:  

Thanks for the contribution, @dimitrisp! It's very cool to see the effort you are putting in to keep the Greek translation team running as smoothly as possible - great stuff!

As for the review; I think there are some places like IsSteemLink where you could use a regex to see if it's valid, and then split it by groups to get the information you need. Not really important though, just thought I'd mention it.

In some places there are magic numbers, like for example $hasaccess == 2. What is 2? I personally would define some constants and use those instead, which should improve the readability of the code.

The commit messages are already great, so my only suggestion is that you should try and keep the subject a bit shorter. Around 50 characters is normally the recommended number.

As it was already mentioned by @codingdefined and you said you are already working on it, I won't comment on the number of nested if statements haha.

Looking forward to seeing what other great features you add - it's really coming along nicely! P.S. you should making think about using pull requests, as it will save you some effort in linking all the commits (I know how tedious that is, haha).


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? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

I think there are some places like IsSteemLink where you could use a regex to see if it's valid, and then split it by groups to get the information you need

Yeah that's probably how I'm going to handle this

In some places there are magic numbers, like for example $hasaccess == 2. What is 2? I personally would define some constants and use those instead, which should improve the readability of the code.

I know it is a bad way to do this, but those magic numbers are access levels, and I'm still designing the whole concept in my mind, so I'll fix it soon.

Thank you for all the suggestions @amosbastian, I really enjoyed your review, and I'll do my best to make this software as great as possible, as it will be a great help to use it! :)

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

Hi, @dimitrisp!

You just got a 5.1% 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.

Hi @dimitrisp!

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

Keep up the wonderful work @dimitrisp, thank you for this amazing tool!

Hey, @dimitrisp!

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

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

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

Vote for Utopian Witness!

I upvoted your post.

Keep steeming for a better tomorrow.
@Acknowledgement - God Bless

Posted using https://Steeming.com condenser site.