Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[WIP/Don't Merge] Migrated Profile from Rxjava to Retroift & added MVVM Architecture (part 1) #6082

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

neeldoshii
Copy link
Contributor

@neeldoshii neeldoshii commented Dec 26, 2024

Part of:

Description:

The following PR focuses on removing the RxJava usage for Achievement Screen, split the code into a MVVM pattern, cleaned the code and also fixed the flow of the AchievementScreen.

Also, there seems to be an improvement in the loading time of the achievements by some seconds (probably 1-2 seconds) compared to the main branch.

2024-12-26 20:25:54.028 loadTime                fr.free.nrw.commons                  D  The loadtime is 3318ms

@neeldoshii neeldoshii marked this pull request as draft December 26, 2024 15:04
@neeldoshii neeldoshii changed the title Migrated from Rxjava to Retroift, added MVVM Architecture. [Don't Merge] Migrated Profile from Rxjava to Retroift & added MVVM Architecture (part 1) Dec 26, 2024
import timber.log.Timber
import javax.inject.Inject

class ProfileRepository @Inject constructor(private val apiService: APIService) {

This comment was marked as resolved.

) : Response<Int>


// https://tools.wmflabs.org/commons-android-app/tool-commons-android-app//feedback.py?user=Devanonymous
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this should I provide kdoc here? and if yes kdoc should I link the common apps API endpoint doc or provide a CURL link here?

Copy link
Member

Choose a reason for hiding this comment

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

API endpoint doc is great if there is one. :-)

@neeldoshii neeldoshii changed the title [Don't Merge] Migrated Profile from Rxjava to Retroift & added MVVM Architecture (part 1) [WIP/Don't Merge] Migrated Profile from Rxjava to Retroift & added MVVM Architecture (part 1) Dec 26, 2024
@neeldoshii
Copy link
Contributor Author

Hi @nicolas-raoul,
I have been trying to break Achievement Fragment for a while on main.

compositeDisposable.add(
okHttpJsonApiClient
.getAchievements(userName ?: return)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
{ response ->
if (response != null) {
setUploadCount(Achievements.from(response))
} else {
Timber.d("Success")
// TODO Create a Method to Hide all the Statistics
// binding.layoutImageReverts.visibility = View.INVISIBLE
// binding.achievementBadgeImage.visibility = View.INVISIBLE
// If the number of edits made by the user are more than 150,000
// in some cases such high number of wiki edit counts cause the
// achievements calculator to fail in some cases, for more details
// refer Issue: #3295
if (numberOfEdits <= 150_000) {
showSnackBarWithRetry(false)
} else {
showSnackBarWithRetry(true)
}
}
},

My Question :

  1. Difference between the editcount received from both the api (https://commons.wikimedia.org/w/api.php?action=query&list=users&usprop=editcount&ususers=Syced&format=json) & ((https://commons-android-app.toolforge.org/tool-commons-android-app/wikidataedits.py?user=Syced)

  2. I have hardcoded my username to your username(Syced) to test achievement with a high upload profile. Despite your edit count having less than 150000 server times out at your username (https://tools.wmflabs.org/commons-android-app/tool-commons-android-app/feedback.py?user=Syced) why is that? what should be the ideal editcount for our server to be able to handle it?

@neeldoshii
Copy link
Contributor Author

Soft ping @nicolas-raoul any idea about this #6082 (comment)

@nicolas-raoul
Copy link
Member

  1. https://commons-android-app.toolforge.org/tool-commons-android-app/wikidataedits.py?user=Syced is only for Wikidata edits.It gets shown as "Nearby edits" in Achievements.

  2. I guess the script got slower for some reason. Maybe we should change from 150000 to 10000 or something similar.

@neeldoshii
Copy link
Contributor Author

I guess the script got slower for some reason. Maybe we should change from 150000 to 10000 or something similar.

My guess is something else is the reason. From Leaderboard -> Weekly -> Upload. I see the top user as GeographBot who has around 29k upload counts. Even his profile is not opening.

Wikidata edits Url of GeographBot (0 EditCount) : https://tools.wmflabs.org/commons-android-app/tool-commons-android-app/wikidataedits.py?user=GeographBot

Achievements : https://tools.wmflabs.org/commons-android-app/tool-commons-android-app/feedback.py?user=GeographBot (Weekly Upload Count 29k)

This GeographBot has 0 wikidataedits still achievements doesn't load. So I think the wikidataeduts is not the reason for not loading achievements.

Sturm User Url : https://tools.wmflabs.org/commons-android-app/tool-commons-android-app/feedback.py?user=Sturm (Weekly Upload Count : 440)

On closer look I am unable to open top users achievement who has highest upload count from leaderboard. I am not sure what the actual reason for timeout needs investigation.

@nicolas-raoul
Copy link
Member

If the focus of this PR is architecture, don't worry too much about achievement timeouts or wrong counts, don't hesitate to file other issues for these. :-)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants