-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat: ✨ allow for collection of multiple trees per day #18
base: main
Are you sure you want to change the base?
Conversation
Modify the code to allow for multiple trees per day closed bk20dev#8
app/src/main/java/pl/bk20/forest/stats/presentation/StatsDetailsViewModel.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/pl/bk20/forest/stats/presentation/StatsDetailsFragment.kt
Outdated
Show resolved
Hide resolved
And by the way, don't hesitate to create multiple commits. It's generally a bad idea to force push them to origin. |
Perfect that I read that just AFTER creating that commit ._. Yeah, thanks for letting me know. I love to learn and clearly you have more experience than me! ❤️ |
@@ -9,7 +9,7 @@ import java.time.LocalDate | |||
@Dao | |||
interface DayDao { | |||
|
|||
@Query("SELECT steps / goal as treeAmount FROM day WHERE steps >= goal") | |||
@Query("SELECT SUM(steps/goal) FROM day WHERE steps >= goal") |
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.
You can drop the WHERE steps >= goal
. The SUM
will only count collected trees. This is because we're dividing integers here.
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.
At least I think so. Please confirm it still works as expected.
Modify the code to allow for multiple trees per day.
This commit also changes the display of the trees per day in the Stats -> Details view
New version of the details page (After the change
Old version of the details page (Before the change
What has changed
steps / goal
instead of just counting the days where thesteps >= goal
steps / goal
instead of just usingsteps >= goal
closed #8