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

View this thread on steempeak.com
· @dimitrisp · (edited)
$72.60
[Aristotle App] Add Contribution, Weekly LM Reports and more...
#### Repository

https://github.com/dimitrisp2/AristotleApp

## About Aristotle App

<center>![](https://i.imgur.com/zjsDJ7g.png)</center>

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](https://steemit.com/utopian-io/@dimitrisp/aristotle-app-dynamic-navbar-contributions-list-project-view-page-and-more), 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](https://steemit.com/utopian-io/@dimitrisp/aristotle-app-dynamic-navbar-contributions-list-project-view-page-and-more#@codingdefined/re-dimitrisp-aristotle-app-dynamic-navbar-contributions-list-project-view-page-and-more-20181023t120840998z).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 

<center>![](https://i.imgur.com/jBSg4yv.png)</center>

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.

<center>![](https://i.imgur.com/f0SPYMM.png)</center>

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.

<center>![](https://i.imgur.com/us2Qixy.png)</center>

<sub>*Related commits: [[ae6f721](https://github.com/dimitrisp2/AristotleApp/commit/ae6f72179e9eeeaea0a8533874e6710cad5c0d9d)], [[27bbb49](https://github.com/dimitrisp2/AristotleApp/commit/27bbb492d817bc14a64d77eaf5fc951d9f09f90b)], [[f699b48](https://github.com/dimitrisp2/AristotleApp/commit/f699b48000617a79eacd2b5ec2d03bcf24aaf138)], [[37faa81](https://github.com/dimitrisp2/AristotleApp/commit/37faa8127636887d51adc2595d73becbcee5d43c)], [[d27c2f9](https://github.com/dimitrisp2/AristotleApp/commit/d27c2f9511c48bbceb47b29bcee7a76baa6e5a36)]*</sub>

---

### 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.

<center>![](https://i.imgur.com/Us1PVKs.png)</center>

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.

<sub>*Related commits: [[51391ff](https://github.com/dimitrisp2/AristotleApp/commit/51391ffecd4ff141fa2b5635cd78124dbd8b5290)], [[3e05f30](https://github.com/dimitrisp2/AristotleApp/commit/3e05f30d5b8377e574d7676dcd58dfaf54c024a2)], [[15a8032](https://github.com/dimitrisp2/AristotleApp/commit/15a8032d60600629ba13cc1b581ff77d5f680d67)], [[c26be19](https://github.com/dimitrisp2/AristotleApp/commit/c26be192410017ac65cfc76a36286c1e96cd4153)], [[f73a08d](https://github.com/dimitrisp2/AristotleApp/commit/f73a08d4fc748f5dd90c752afe0adb4dad2ba222)]*</sub>

---

### 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***.


<sub>*Related commit: [[f73a08d](https://github.com/dimitrisp2/AristotleApp/commit/f73a08d4fc748f5dd90c752afe0adb4dad2ba222)]*</sub>

#### 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.

<sub>*Related commits: [[84ce88e](https://github.com/dimitrisp2/AristotleApp/commit/84ce88ed4ef7908f4813cedc561eb019f3fa5150)], [[f73a08d](https://github.com/dimitrisp2/AristotleApp/commit/f73a08d4fc748f5dd90c752afe0adb4dad2ba222)]*</sub>

#### 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.

<sub>*Related commits: [[3e05f30](https://github.com/dimitrisp2/AristotleApp/commit/3e05f30d5b8377e574d7676dcd58dfaf54c024a2)], [[820df65](https://github.com/dimitrisp2/AristotleApp/commit/820df659c84ad21612974f0dcf1a866725cdc9bf)]*</sub>

#### 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!

<sub>*Related commit: [[23eca0d](https://github.com/dimitrisp2/AristotleApp/commit/23eca0d92e7ac3e9017be4820686c41b2a618e25)]*</sub>

---

### 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](https://steemit.com/utopian-io/@dimitrisp/aristotle-app-an-app-to-supplement-the-utopian-translation-teamwork) *[2018-10-15]*
2. [Dynamic NavBar, Contributions List, Project View page,  and more...](https://steemit.com/utopian-io/@dimitrisp/aristotle-app-dynamic-navbar-contributions-list-project-view-page-and-more) *[2018-10-22]*

---

##### How to contribute?

You can find me on [Utopian's discord](https://discord.gg/vMGmDSm) 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
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 28 others
properties (23)
post_id65,109,412
authordimitrisp
permlinkaristotle-app-add-contribution-weekly-lm-reports-and-more
categoryutopian-io
json_metadata{"image":["https:\/\/i.imgur.com\/zjsDJ7g.png"],"format":"markdown","app":"steempeak","links":["https:\/\/github.com\/dimitrisp2\/AristotleApp","\/@utopian-io","\/@aristotle.team","https:\/\/steemit.com\/utopian-io\/@dimitrisp\/aristotle-app-dynamic-navbar-contributions-list-project-view-page-and-more","\/@codingdefined","https:\/\/steemit.com\/utopian-io\/@dimitrisp\/aristotle-app-dynamic-navbar-contributions-list-project-view-page-and-more#@codingdefined\/re-dimitrisp-aristotle-app-dynamic-navbar-contributions-list-project-view-page-and-more-20181023t120840998z","\/@codingdefined","https:\/\/github.com\/dimitrisp2\/AristotleApp\/commit\/ae6f72179e9eeeaea0a8533874e6710cad5c0d9d","https:\/\/github.com\/dimitrisp2\/AristotleApp\/commit\/27bbb492d817bc14a64d77eaf5fc951d9f09f90b","https:\/\/github.com\/dimitrisp2\/AristotleApp\/commit\/f699b48000617a79eacd2b5ec2d03bcf24aaf138"],"users":["utopian-io","aristotle.team.","dimitrisp","codingdefined","rosatravels","utopian-io."],"community":"steempeak","tags":["utopian-io","development","software","greek","aristotle-team"]}
created2018-10-29 07:52:51
last_update2018-10-29 07:54:12
depth0
children8
net_rshares65,243,846,024,973
last_payout2018-11-05 07:52:51
cashout_time1969-12-31 23:59:59
total_payout_value54.212 SBD
curator_payout_value18.386 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length9,909
author_reputation74,131,024,130,091
root_title"[Aristotle App] Add Contribution, Weekly LM Reports and more..."
beneficiaries
0.
accountaristotle.team
weight100
1.
accountutopian.pay
weight500
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (92)
@acknowledgement ·
fossbot voter comment
I upvoted your post.

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

Posted using https://Steeming.com condenser site.
πŸ‘Ž  
properties (23)
post_id65,110,144
authoracknowledgement
permlinkre-dimitrisp-aristotle-app-add-contribution-weekly-lm-reports-and-more-20181029t081140925z
categoryutopian-io
json_metadata{}
created2018-10-29 08:11:42
last_update2018-10-29 08:11:42
depth1
children0
net_rshares-9,952,956,537
last_payout2018-11-05 08:11:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length143
author_reputation886,702,183,221
root_title"[Aristotle App] Add Contribution, Weekly LM Reports and more..."
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@steem-plus ·
SteemPlus upvote
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](https://steemit.com/@steem-plus) to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.
properties (22)
post_id65,116,528
authorsteem-plus
permlinkaristotle-app-add-contribution-weekly-lm-reports-and-more---vote-steemplus
categoryutopian-io
json_metadata{}
created2018-10-29 10:46:27
last_update2018-10-29 10:46:27
depth1
children0
net_rshares0
last_payout2018-11-05 10:46:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length435
author_reputation247,995,867,762,997
root_title"[Aristotle App] Add Contribution, Weekly LM Reports and more..."
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@amosbastian · (edited)
$10.07
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](https://join.utopian.io/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](https://review.utopian.io/result/3/1222222).

---- 
Need help? Write a ticket on https://support.utopian.io/. 
Chat with us on [Discord](https://discord.gg/uTyJkNm). 
[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , , , , , , , , , , , ,
properties (23)
post_id65,118,931
authoramosbastian
permlinkre-dimitrisp-aristotle-app-add-contribution-weekly-lm-reports-and-more-20181029t113613381z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["dimitrisp","codingdefined"],"links":["https:\/\/join.utopian.io\/guidelines","https:\/\/review.utopian.io\/result\/3\/1222222","https:\/\/support.utopian.io\/","https:\/\/discord.gg\/uTyJkNm","https:\/\/join.utopian.io\/"],"app":"steemit\/0.1"}
created2018-10-29 11:36:12
last_update2018-10-29 11:43:51
depth1
children2
net_rshares8,650,376,042,026
last_payout2018-11-05 11:36:12
cashout_time1969-12-31 23:59:59
total_payout_value7.636 SBD
curator_payout_value2.437 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,686
author_reputation174,225,255,912,876
root_title"[Aristotle App] Add Contribution, Weekly LM Reports and more..."
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (14)
@dimitrisp ·
> 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! :)
properties (22)
post_id65,123,352
authordimitrisp
permlinkre-amosbastian-re-dimitrisp-aristotle-app-add-contribution-weekly-lm-reports-and-more-20181029t130659466z
categoryutopian-io
json_metadata{"users":["amosbastian"],"tags":["utopian-io"],"app":"steemit\/0.1"}
created2018-10-29 13:06:57
last_update2018-10-29 13:06:57
depth2
children0
net_rshares0
last_payout2018-11-05 13:06:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length749
author_reputation74,131,024,130,091
root_title"[Aristotle App] Add Contribution, Weekly LM Reports and more..."
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@utopian-io ·
Thank you for your review, @amosbastian! Keep up the good work!
properties (22)
post_id65,340,502
authorutopian-io
permlinkre-re-dimitrisp-aristotle-app-add-contribution-weekly-lm-reports-and-more-20181029t113613381z-20181102t032043z
categoryutopian-io
json_metadata{"app":"beem\/0.20.9"}
created2018-11-02 03:20:45
last_update2018-11-02 03:20:45
depth2
children0
net_rshares0
last_payout2018-11-09 03:20:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length63
author_reputation152,913,012,544,965
root_title"[Aristotle App] Add Contribution, Weekly LM Reports and more..."
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@steem-ua ·
#### 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](https://discord.gg/KpBNYGz)**
properties (22)
post_id65,119,196
authorsteem-ua
permlinkre-aristotle-app-add-contribution-weekly-lm-reports-and-more-20181029t114147z
categoryutopian-io
json_metadata{"app":"beem\/0.20.7"}
created2018-10-29 11:41:48
last_update2018-10-29 11:41:48
depth1
children0
net_rshares0
last_payout2018-11-05 11:41:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length288
author_reputation23,203,609,903,979
root_title"[Aristotle App] Add Contribution, Weekly LM Reports and more..."
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@lordneroo ·
Keep up the wonderful work @dimitrisp, thank you for this amazing tool!
properties (22)
post_id65,124,891
authorlordneroo
permlinkre-dimitrisp-aristotle-app-add-contribution-weekly-lm-reports-and-more-20181029t133832169z
categoryutopian-io
json_metadata{"app":"steemit\/0.1","users":["dimitrisp"],"tags":["utopian-io"]}
created2018-10-29 13:38:33
last_update2018-10-29 13:38:33
depth1
children0
net_rshares0
last_payout2018-11-05 13:38:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length71
author_reputation213,796,208,950,223
root_title"[Aristotle App] Add Contribution, Weekly LM Reports and more..."
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@utopian-io ·
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](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)).

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

<a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
properties (22)
post_id65,392,140
authorutopian-io
permlinkre-aristotle-app-add-contribution-weekly-lm-reports-and-more-20181103t011242z
categoryutopian-io
json_metadata{"app":"beem\/0.20.9"}
created2018-11-03 01:12:45
last_update2018-11-03 01:12:45
depth1
children0
net_rshares0
last_payout2018-11-10 01:12:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length591
author_reputation152,913,012,544,965
root_title"[Aristotle App] Add Contribution, Weekly LM Reports and more..."
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000