-
-
Notifications
You must be signed in to change notification settings - Fork 738
YiR: Create Reading Patterns slide #5982
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
Changes from 6 commits
63d593d
ac8f049
87c6406
34757b4
f19e3a8
6b55617
97b9f79
ed95986
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -172,6 +172,29 @@ class YearInReviewViewModel() : ViewModel() { | |
| editCount += wikidataResponse.query?.userInfo!!.editCount | ||
| editCount += commonsResponse.query?.userInfo!!.editCount | ||
|
|
||
| val favoriteTimeToRead = async { | ||
| AppDatabase.instance.historyEntryDao() | ||
| .getFavoriteTimeToReadSince(startTimeInMillis, endTimeInMillis) | ||
| } | ||
|
|
||
| val favoriteDayToRead = async { | ||
| AppDatabase.instance.historyEntryDao() | ||
| .getFavoriteDayToReadSince(startTimeInMillis, endTimeInMillis) | ||
| } | ||
|
|
||
| val mostReadingMonth = async { | ||
| AppDatabase.instance.historyEntryDao() | ||
| .getMostReadingMonthSince(startTimeInMillis, endTimeInMillis) | ||
| } | ||
|
|
||
| val favoriteTimeToReadHour = favoriteTimeToRead.await() ?: 0 | ||
|
|
||
| val favoriteDayToReadIndex = favoriteDayToRead.await()?.let { | ||
| it % 7 | ||
|
||
| } ?: 0 | ||
|
|
||
| val mostReadingMonthIndex = mostReadingMonth.await() ?: 1 | ||
|
|
||
| yearInReviewModelMap[YIR_YEAR] = YearInReviewModel( | ||
| enReadingTimePerHour = 0L, // TODO: remote config | ||
| enPopularArticles = listOf("Dog", "Cat", "Bear", "Bird", "Tiger"), // TODO: remote config | ||
|
|
@@ -192,9 +215,9 @@ class YearInReviewViewModel() : ViewModel() { | |
| localSavedArticles = randomSavedArticleTitles.await(), | ||
| localTopVisitedArticles = topVisitedArticlesForTheYear.await(), | ||
| localTopCategories = topVisitedCategoryForTheYear.await(), | ||
| favoriteTimeToRead = "Evening", | ||
| favoriteDayToRead = "Saturday", | ||
| favoriteMonthDidMostReading = "March", | ||
| favoriteTimeToRead = favoriteTimeToReadHour, | ||
| favoriteDayToRead = favoriteDayToReadIndex, | ||
| favoriteMonthDidMostReading = mostReadingMonthIndex, | ||
| closestLocation = Pair(0.0, 0.0), | ||
| closestArticles = emptyList(), | ||
| userEditsCount = editCount, | ||
|
|
||
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.
Pending. Please share other ideas on how to set up the hour based on the timezone properly.
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.
will do in a followup.