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

Enhancing FeedbackScreen with Performance Metrics #283

Merged
merged 12 commits into from
Dec 18, 2024

Conversation

baptisteghostine
Copy link
Contributor

@baptisteghostine baptisteghostine commented Dec 14, 2024

Summary

This PR enhances the FeedbackScreen by integrating key performance metrics—Talk Time (Seconds) and Talk Time (Percentage)—to provide users with valuable insights into their speaking sessions. It introduces a reusable composable function, MetricDisplayItem, to streamline the presentation of metrics and improve code maintainability. Comprehensive UI tests have been added to validate the correctness and reliability of these features.

Related Issues

image

Key Changes

1. Display of Performance Metrics in FeedbackScreen
  • Talk Time (Seconds): Shows the average duration the user spends speaking during a session.
  • Talk Time (Percentage): Indicates the proportion of speaking time relative to pauses, offering insights into pacing.
2. Creation of MetricDisplayItem Composable
  • A new composable function designed to display metrics in a consistent, reusable format.
  • Enhances code reusability, reducing redundancy and simplifying future updates.
3. UI Enhancements
  • Updated the layout of the FeedbackScreen to accommodate the new metrics seamlessly without disrupting existing design elements.
  • Maintained consistent theming and styling across the screen.

4. ChatGPT Prompt Displayed

  • Removed ChatGPT Prompt being the first message you see on ChatScreen. User should not see this on the app.
4. Comprehensive UI Testing
  • Added tests to verify:
    • Presence and visibility of metric titles and values.
    • Display of "No data" when metrics are unavailable.
    • Navigation and error handling in conjunction with the new metrics.

Example Interaction

Scenario: User Completes a Session

  1. Performance Metrics Displayed:
    • Talk Time (Seconds): 120.00
    • Talk Time (Percentage): 75.50%
  2. Feedback Messages:
    • Displays contextual feedback, e.g., "Great job! Keep it up."
    • Indicates the number of successful sessions relevant to the user's practice context.
  3. User Interaction:
    • Clicking the "Try Again" button resets the practice context and navigates back to the Home screen.
    • In case of errors, an appropriate error message replaces the metrics.

Strengths

  • Valuable Insights: Adding performance metrics provides users with actionable data to improve their speaking performance.
  • Reusable Design: The MetricDisplayItem composable simplifies code structure and enhances maintainability.
  • Comprehensive Testing: Extensive UI tests ensure reliability, covering performance metrics, error handling, and navigation flows.
  • UI Consistency: Seamless integration of new features without disrupting the existing layout or styling.

Potential Areas for Improvement

3. Future Scalability
  • Plan for the addition of new metrics by extending the composable's design and testing framework.

Conclusion

This PR significantly enhances the FeedbackScreen by introducing essential performance metrics and improving the overall user experience. The reusable MetricDisplayItem composable and comprehensive testing ensure a maintainable and robust implementation. I'm looking forward for your comments on this new PR!

@baptisteghostine baptisteghostine marked this pull request as ready for review December 18, 2024 21:46
}
}
else -> {
Text(
text = "No feedback available.",
style = AppTypography.bodyLargeStyle,
color = MaterialTheme.colorScheme.secondary)
color = MaterialTheme.colorScheme.secondary,
modifier = Modifier.testTag("feedbackNoMessage"))
Copy link
Contributor

@ymarc11 ymarc11 Dec 18, 2024

Choose a reason for hiding this comment

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

Good adaptation for the dark mode. Well done.

// Display Talk Time Percentage
MetricDisplayItem(
title = "Talk Time (Percentage)",
value =
Copy link
Contributor

Choose a reason for hiding this comment

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

Could have added tests for the MetricDisplayItem.

var feedbackMessage by remember { mutableStateOf<String?>(null) }
var decisionResult by remember { mutableStateOf<ChatViewModel.DecisionResult?>(null) }
var isLoading by remember { mutableStateOf(true) }
var errorMessage by remember { mutableStateOf<String?>(null) }

val practiceContext by apiLinkViewModel.practiceContext.collectAsState()
val userProfile by userProfileViewModel.userProfile.collectAsState()
val talkTimePercentageMean = userProfile?.statistics?.talkTimePercMean
Copy link
Contributor

Choose a reason for hiding this comment

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

You should replace the talk time percentage mean by the paceMean.

Copy link
Contributor

@ymarc11 ymarc11 left a comment

Choose a reason for hiding this comment

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

The pull request significantly enhances the FeedbackScreen by adding performance metrics (Talk Time in Seconds and Percentage) and introducing a reusable composable function for displaying metrics. It maintains strong UI consistency and adds robust testing, ensuring maintainability and improved user experience. Good code coverage, 0 code duplication and CI passes. Well done.

Feature Value:

  • Adding Talk Time metrics provides insights into users' speaking sessions, improving the app's value. (Talk Time percentage could be replaced by pace as we updated it in stats screen)
  • The feedback messages guide users effectively, encouraging further interactions.
  • Introducing MetricDisplayItem composable is a clean and reusable solution, reducing redundancy.

UI Consistency:

  • The FeedbackScreen integrates well the new metrics without disrupting existing layouts.
  • Proper alignment and styling are maintained

UI Test Coverage:

  • The PR introduces comprehensive UI tests to validate the presence and visibility of metric titles and values.

Fixes:

  • Well done removing the ChatGPT Prompt being the first message we see on ChatScreen. (Though not related to this PR. It would be better to do it in another PR)

Suggestions:

  • Could add UI tests for MetricDisplayItem (your code coverage is good regardless)
  • You should replace the talk time percentage stat by the pace to be consistent with the stat screen
  • Generally, avoid doing unrelated tasks in the same PR (in this case its a small change)

Overall, other than the replacement of talk time percentage by the pace your PR is ready for merging. Good job.

@ymarc11 ymarc11 merged commit c588d81 into main Dec 18, 2024
3 checks passed
@ymarc11 ymarc11 deleted the feature/improve-feedback-2 branch December 19, 2024 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants