Skip to content

Conversation

@tanvidadu
Copy link
Contributor

@tanvidadu tanvidadu commented Jun 14, 2018

Tutorial and Quiz

Fixes #274

Description (required)

Implemented a basic layout for the quiz
added functionality to calculate the score and display result
Implemented quiz and displayed answers with explanation
Displayed Congratulatory message as well as warnings
Implemented Counter and class to check the parameters to call quiz
Implemented back functionality for quiz
Added ProgressBar
Added functionality to share result

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.

@tanvidadu tanvidadu changed the base branch from master to gamification June 18, 2018 15:37
@commons-app commons-app deleted a comment Jun 18, 2018
@codecov-io
Copy link

codecov-io commented Jun 18, 2018

Codecov Report

Merging #1629 into gamification will decrease coverage by 0.15%.
The diff coverage is 0%.

Impacted file tree graph

@@               Coverage Diff               @@
##           gamification   #1629      +/-   ##
===============================================
- Coverage          3.86%    3.7%   -0.16%     
===============================================
  Files               151     157       +6     
  Lines              7587    7911     +324     
  Branches            710     726      +16     
===============================================
  Hits                293     293              
- Misses             7277    7601     +324     
  Partials             17      17
Impacted Files Coverage Δ
...w/commons/contributions/ContributionsActivity.java 0% <0%> (ø) ⬆️
.../java/fr/free/nrw/commons/quiz/QuizController.java 0% <0%> (ø)
...a/fr/free/nrw/commons/quiz/QuizResultActivity.java 0% <0%> (ø)
...ain/java/fr/free/nrw/commons/quiz/QuizChecker.java 0% <0%> (ø)
...in/java/fr/free/nrw/commons/quiz/QuizQuestion.java 0% <0%> (ø)
...ava/fr/free/nrw/commons/quiz/RadioGroupHelper.java 0% <0%> (ø)
...rw/commons/mwapi/ApacheHttpClientMediaWikiApi.java 4.77% <0%> (-0.22%) ⬇️
...in/java/fr/free/nrw/commons/quiz/QuizActivity.java 0% <0%> (ø)
...main/java/fr/free/nrw/commons/WelcomeActivity.java 0% <0%> (ø) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f6c18c6...cbfde8d. Read the comment docs.

app/build.gradle Outdated
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$LEAK_CANARY"
testImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$LEAK_CANARY"

implementation "com.google.dagger:dagger:$DAGGER_VERSION"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

App already uses dagger. :)

@commons-app commons-app deleted a comment Jun 25, 2018
@commons-app commons-app deleted a comment Jun 25, 2018
@commons-app commons-app deleted a comment Jun 27, 2018
@commons-app commons-app deleted a comment Jun 29, 2018
@commons-app commons-app deleted a comment Jun 29, 2018
@commons-app commons-app deleted a comment Jul 5, 2018
@misaochan
Copy link
Member

misaochan commented Jul 20, 2018

@tanvidadu Thanks for the pointer. :) I re-tested and the quiz works well for me, well done! 👍

One issue:

  • After I'm done with the quiz, the revertCount is -55, when I initially set it to 60. I think this is a bug with the calculations?

image

A few critiques for the UI:

  • It feels unexpected for the user to have the tutorial pop up after they say "Yes" to taking a quiz. Also, the first dialog feels a bit like a wall of text.

To fix both of these, I think we should break up <string name="quiz_alert_message">More than %1$s of the images you uploaded have been deleted. If you carry on uploading images that require deletion, your account will likely be banned. Would you like to take a quiz to help you learn what type of images you should or shouldn\'t upload?</string> into two paragraphs, and add mention of the tutorial to the 2nd paragraph, i.e.:

"More than %1$s of the images you uploaded have been deleted. If you carry on uploading images that require deletion, your account will likely be banned."

"Would you like to view the tutorial again and then take a quiz to help you learn what type of images you should or shouldn't upload?"

  • I do not think the extra warning in the last screen of the quiz is necessary:

image

Testing:

Additionally, I think it would really help with the testing (and look good in your final blog post), if you could do a screencast walking people through the quiz steps.

  • You could start with demonstrating various revert counts in the debugger and that the quiz pops up appropriately for them. Some edge conditions, like an upload count of 0 and revert count of 0, or a revert count at just 50% but not more. And finally a revert count >50%, which is when the quiz shows up
  • Walk the user through the tutorial and quiz
  • Finally, go back to the debugger and demonstrate the process of needing another 5 uploads before the quiz pops up again

Copy link
Member

@misaochan misaochan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional spelling/whitespace comments

private String url;
private String answerMessage;

QuizQuestion( int questionNumber, String question, String url, boolean answer, String answerMessage){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please ensure that you use consistent whitespaces. We don't use whitespaces before the first parameter of a method, and there is usually a whitespace between the ) and the {. Please check the rest of your code as well, as there are a few more instances of this. Thanks!

* share the screenshot through social media
* @param bitmap
*/
void shareScreen ( Bitmap bitmap){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aaahhhh whitespaces.... ;)

* to calculate the number of images reverted after previous quiz
* @param revertCountFetched
*/
private void setRevertParamter( int revertCountFetched){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameter

import timber.log.Timber;

/**
* to check whether to pop quiz or not
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have more detailed Javadocs, especially for classes - the reader should be able to have a fairly detailed idea of what the class does based on the Javadocs alone. For instance, see this example: http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#examples (I personally think that is a bit much, we certainly don't need 20+ line docs, lol. But more detail than the present is needed).

How about something like "Fetches the number of images the user has uploaded and the number of images reverted, in order to calculate the % of reverts. Then calls quiz if the revert parameter exceeds the required percentage."


import java.util.ArrayList;
import java.util.List;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs Javadocs


import java.io.File;
import java.io.FileOutputStream;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about a Javadoc like "Displays the final page of the quiz, which congratulates user and shows them their quiz score"?

@tanvidadu
Copy link
Contributor Author

@misaochan I will work on these changes and update the pr :) thanks!

After I'm done with the quiz, the revertCount is -55, when I initially set it to 60. I think this is a bug with the calculations?

revertCount = total number of reverts( up till know) - number of reverts of the last quiz
Manually setting it to the number of reverts to 60 before quiz, while the total number of reverts is less than 60, might be reason for negative revertCount.

I will add checks for negative revertCount 👍

@commons-app commons-app deleted a comment Jul 21, 2018
@commons-app commons-app deleted a comment Jul 21, 2018
@tanvidadu
Copy link
Contributor Author

@misaochan @maskaravivek @nicolas-raoul @neslihanturan I have incorporated the suggested changes !

I will soon upload the video walking people through the quiz steps as mentioned above.
I have made a few changes in UI too. Please review them once !
Also, I like your opinion on which of these two is better? Thanks :)

@misaochan
Copy link
Member

I am actually undecided on which of the two looks better, haha! Would anyone like to weigh in?

@neslihanturan
Copy link
Collaborator

Well, second next button gives me feeling of something is missing. I think Taj Mahal UI is better than Nicolas selfie UI:)

@nicolas-raoul
Copy link
Member

Any is fine I would say.
Go for the first one since it has got one more vote :-)

@misaochan misaochan changed the title Quiz [WIP] Quiz Jul 24, 2018
<string name="quiz_question_string">Is this picture OK to upload?</string>
<string name="question">Question</string>
<string name="result">Result</string>
<string name="quiz_back_button">End quiz ? </string>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I just realized this string is displayed when the user tries to prematurely end the quiz. In that case I think more explanation is in order, perhaps "If you carry on uploading images that require deletion, your account will likely be banned. Are you sure you want to end the quiz?".

@misaochan
Copy link
Member

misaochan commented Jul 24, 2018

Great job, @tanvidadu ! I changed the title of your PR, as this isn't a WIP anymore. :) I'm happy to approve this PR pending the final change that I requested. We can merge this when @maskaravivek is back this week, if he approves it as well.

It seems you are almost done with your GSoC, congratulations! :) I think the next steps would be to:

  • merge this branch into master, after this PR is merged you can create a new PR similar to Add feature to Browse commons via app #1716
  • do some testing with edge conditions as I requested above, and report the results
  • polish up your screencast for the final blog post (a voiceover explaining what you are doing would be nice, if you have a mic)

Is there anything else that we are missing?

@commons-app commons-app deleted a comment Jul 24, 2018
@maskaravivek
Copy link
Contributor

@tanvidadu I see that some of my comments are still unaddressed. :)

Can you check the pending comments, especially the string resources thing?

@tanvidadu
Copy link
Contributor Author

tanvidadu commented Jul 24, 2018

Sorry @maskaravivek I somehow missed them!
I will incorporate them asap :)

@commons-app commons-app deleted a comment Jul 25, 2018
@maskaravivek maskaravivek merged commit 99dac94 into commons-app:gamification Jul 26, 2018
maskaravivek pushed a commit that referenced this pull request Jul 27, 2018
* Quiz  (#1629)

*  Layout inflated

*  Layout for mcq added

*  Inflated Basic Layout

*  Implemented basic flow

*  Added the basic implementation pf score

*  Added the result layout

*  Added the result layout

*  Added functionality to set result

*  Changed the launcher intent to Quiz Activity for testing purpose

*  Explanations of answers added

*  Improved the layout of quiz result a bit

*  Fixed some minor issues

*  Fixed build issues

* Api Added and basic structure for calling implemented

* Added intents

*  Added the title

*  Fixed image error and improved quality of pr

*  Made separate class for checking quiz

*  Added counter

* Implemented back and next for quiz result

*  Added back functionality to quiz

*  Added progressBar

*  Fixed bugs

*  Improved code quality

*  Imporved code Quality

*  Updated strings

*  Added share screenshot function

*  Added checks and improved UI

*  Removed unused string

*  Removed unused string

* Adding checks and improving code quality

* Changed string

* Improved code quality

* Update strings.xml

* Update MediaWikiApi.java

* Fix build
@tanvidadu tanvidadu deleted the quiz branch August 3, 2018 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants