-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Feedback Module: Add reverts rate parameter #1649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feedback Module: Add reverts rate parameter #1649
Conversation
Codecov Report
@@ Coverage Diff @@
## feedback-gamification #1649 +/- ##
========================================================
- Coverage 3.04% 3.01% -0.04%
========================================================
Files 140 140
Lines 7683 7761 +78
Branches 720 721 +1
========================================================
Hits 234 234
- Misses 7434 7512 +78
Partials 15 15
Continue to review full report at Codecov.
|
@misaochan @maskaravivek pr is ready for review! |
Hi @tanvidadu , thanks for the PR. Looks good to me in general, but unfortunately I can't actually test this until Vivek fixes the API so it can retrieve the deletion rate for my account. So we will have to wait for that before we merge, I think. Are you able to carry on working on the quiz/tutorial in the meantime? |
Yes! since both are separate modules I will continue with quiz/tutorial :) |
Just tested this, works perfectly for me! Great job, @tanvidadu ! :) (And also, this tells me that I need to work on reducing my deletion percentage, lol). Just one final suggestion (and then I think we can merge and wrap up Phase 1 of your project, if @maskaravivek agrees) - what do you think about having 'i' icons next to each parameter for a brief description? This will allow us to keep the main text simple while explaining the statistics more clearly to users. My thoughts on how the final texts could look like, with information text in italics:
|
@misaochan small error on my part :( I have fixed the bug |
@tanvidadu My suggestion is to have the 'i's in a different color from the text, in blue perhaps? :) Thanks for fixing the bug, I will re-test once the information tooltips are completed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @tanvidadu. Changes look good to me. Have just added a few minor comments. :)
try { | ||
achievements.setRevertCount(object.getInt("deletedUploads")); | ||
} catch (JSONException e) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add Timber
logs here. :)
.observeOn(AndroidSchedulers.mainThread()) | ||
.subscribe( | ||
object -> parseJsonRevertCount(object) | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a throwable
subscription too.
*/ | ||
private void setRevertCount(){ | ||
compositeDisposable.add(mediaWikiApi | ||
.getRevertCount(sessionManager.getCurrentAccount().name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can sessionManager.getCurrentAccount()
ever return a null? If yes, add a null check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't return a null till logging in mandatory :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the java docs for this method. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maskaravivek this kind of check?
Optional.ofNullable(sessionManager.getCurrentAccount().name.orElse("")
It requires min API 24 where as min API of Commons app is 15. Any idea how to go about it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simple null
check like this should be enough.
Account currentAccount = sessionManager.getCurrentAccount();
if(currentAccount == null) {
// do something
}
Recently we experienced a few crashes on play store and we suspect that getCurrentAccount
is returning null in some cases even for logged in users.
Refer to this PR for more context:
https://github.com/commons-app/apps-android-commons/pull/1684/files
* used to set the non revert image percentage | ||
* @param notRevertPercentage | ||
*/ | ||
private void setImageRevertPercentage( int notRevertPercentage){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove whitespace. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find white spaces here but throughout the code, I tried to remove all extra white spaces :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think he means the extra whitespace between (
and int
;)
In general it's a good idea to follow the style of existing code. For instance, observe the places there are whitespaces (and no whitespaces) here:
public void onCreate(Bundle savedInstanceState) {
Locale.ENGLISH, | ||
fetchRevertCountUrlTemplate, | ||
new PageTitle(userName).getText()); | ||
String userNameCaps = Character.toString(userName.charAt(0)).toUpperCase()+userName.substring(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually required? MediaWiki usernames always start with a capital letter. Our shared prefs should already have username in this format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Javadocs requested
@@ -1,5 +1,7 @@ | |||
package fr.free.nrw.commons.achievements; | |||
|
|||
import android.util.Log; | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Javadocs are spotty for this class, please have a more descriptive Javadoc here, and add them to all the new methods as well. Thanks! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@misaochan I have updated the javadocs :)
Thanks @tanvidadu . :) Are we ready for me to re-test this? |
Yes! @misaochan thanks :) |
Works for me now, well done @tanvidadu ! :) |
* Implemented Statistics * Basic Structure Implemented * Layout made screen independent and menu inflated * Share Screenshot using cache * Improved the Image Bound and added strings * Improved the quality of Pr * Wired to navigation drawer * Changed the bounds of the image * Added Info icon * Removed the unecessary functionality * Updated JavaDocs and fetch the username * Fetch JsonObject from the api using JavaRx and OkHttp * Added JavaDocs and improved quality * fixed strings file * Improved the quality of pr * Render thanks , images used in articles on screen * fetch and rendered the upload count * FeaturedImages statistics rendered and Javadocs added * added ProgressBar * Added Class for calculating level * added level info and returned level info * level up info rendered on achievement activity * Inflated Level Number * Added the structure for badge * Added LevelUpInfo Programmetically on Drawable * aligned the text * changed the text * Implemented the structure for changing colour of drawable * Added functionality to change colours of badge during runtime * Added custom alert for share option * Improved the UI of screen * Added the alertDialog for info button * Improved the quality of PR * Added Builder model * Added Enum Model and increased levels to 15 * removed redundant class * Changed strings and added subtext * Feedback Module: Add reverts rate parameter (#1649) * Fetched Revert Count * Refactored Achievements class and display the fetched results * Refactored the levelController to include revert as parameter * Fixed error * Fixed bug * Added information for parameters and improved code quality * Javadocs added * Added null check and javadocs * Removed extra spaces
Added Reverts Parameter to FeedBack Module
Fixes #85
Description (required)
Refactored mwApi to fetch count of images reverted
Refactored LevelController and Achievements to add the number of reverts as a parameter.
Tests performed (required)
Tested on BetaDebug and ProdDebug
Screenshots showing what changed (optional)
{Only for user interface changes, otherwise remove this section. See how to take a screenshot}
Note: Please ensure that you have read CONTRIBUTING.md if this is your first pull request.