Skip to content
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

Fix data saving and display in stat screen #298

Merged
merged 8 commits into from
Dec 17, 2024
Merged

Conversation

ymarc11
Copy link
Contributor

@ymarc11 ymarc11 commented Dec 16, 2024

This Pull Request refactors how recent speech analysis data is stored and displayed, going from an ArrayDeque to a List for UserStatistics.recentData to make serialization from firestore easier. Alongside this data model change, the problem in the display of the metrics extracted from the data is now fixed and the UI in StatScreen is updated to be scrollable, ensuring that graphs and statistics are more accessible and visually clear.

Data Model Improvements:

  • Replaced recentData in UserStatistics from an ArrayDeque to a List and made the conversion 'arrayDeque'.toList() in the UserProfileViewModel.
  • Updated UserProfileRepositoryFirestore to correctly extract and map recentData as a list from Firestore (serialization).
  • Update getUserProfile to save correctly the data

UI Enhancements:

  • Made the StatScreen vertically scrollable (on some screens some composables were hidden).
  • Adjusted the values displayed on the y-axis to represent better the intervals of the real values (might change the interval for the talk time seconds y-axis)
  • Updated get metric mean to only take two numbers after the decimal for better and cleaner display of the means on the stat screen

Preview:
UpdStatScr

Related issue:
#273
#297

In this PR , the main bugs of saving and displaying recentData on the statScreen are finally fixed.

@ymarc11 ymarc11 added this to the M3 milestone Dec 16, 2024
@ymarc11 ymarc11 self-assigned this Dec 16, 2024
@ymarc11 ymarc11 linked an issue Dec 16, 2024 that may be closed by this pull request
Copy link
Contributor

@IskandarGhobril IskandarGhobril left a comment

Choose a reason for hiding this comment

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

This PR fixes the stat screen bug and brings solid improvements to both the data model and UI. Great work overall, but I still have a few suggestions for improvement:

  • You could introduce a helper function to generate the graphs and their corresponding text dynamically, instead of repeating similar code multiple times.
  • The "Talk Time Percentage" graph can be removed since it always displays 100% (based on testing). It simplifies the screen and improves clarity
  • We already have a test for documentToUserProfile so adding checks to ensure analysis data is correctly retrieved and mapped from Firestore would not be too hard and it will help reach 80% coverage.
  • Consider adding a helper function for converting Firestore data to AnalysisData. This would keep documentToUserProfile cleaner (check out the mapToSpeechBattle function)

Otherwise, great job on addressing the serialization issues, fixing the UI and the display of the stats. Thanks, Marc!

Copy link
Contributor

@IskandarGhobril IskandarGhobril left a comment

Choose a reason for hiding this comment

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

Great job on achieving 97% line coverage and incorporating my suggestions! For the graph, it might be best to check with the rest of the team to get their input. I'll go ahead and approve it for now. Thanks again, Marc!

@IskandarGhobril IskandarGhobril merged commit c8287cb into main Dec 17, 2024
3 checks passed
@IskandarGhobril IskandarGhobril deleted the fix/stat-screen branch December 17, 2024 21:50
@ymarc11
Copy link
Contributor Author

ymarc11 commented Dec 18, 2024

Regarding the talkTimePercentage, I will do a new PR for replacing it by a more relevant metric as I as well previously found it to be useless.

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.

Fix bugs in stat screen
2 participants