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

Feat/training coach frontend final #231

Merged
merged 63 commits into from
Dec 19, 2024
Merged

Conversation

tercierp
Copy link
Collaborator

@tercierp tercierp commented Dec 17, 2024

Overview

This PR completes the training part of the app, with the option of training with a coach. Both users must be friends to train with a coach. The athlete chooses an activity and the coach can update the athlete's training.

The PR is large, but some of parts has already been reviewed in #232. The problem with this PR is that in order to test whether it works, you need to implement the backend and the frontend to test on two phones.

Visual aspect

demo6

Testing

The testing part doesn't reach 80% line coverage, as I haven't found an easy way to test the observables that are needed during training.

…ining-coach-frontend

# Conflicts:
#	app/src/main/res/values/strings.xml
@tercierp tercierp added the Enhancement ✨ New feature or request label Dec 17, 2024
@tercierp tercierp added this to the Milestone M3 milestone Dec 17, 2024
@tercierp tercierp self-assigned this Dec 17, 2024
@tercierp tercierp linked an issue Dec 18, 2024 that may be closed by this pull request
Copy link
Collaborator Author

@tercierp tercierp Dec 18, 2024

Choose a reason for hiding this comment

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

Note: I did remove a lot of tests, since I refactor the whole PairingRequest

Copy link
Collaborator Author

@tercierp tercierp Dec 18, 2024

Choose a reason for hiding this comment

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

Note: No need to review this file since it was reviewed in this PR #232

@tercierp tercierp marked this pull request as ready for review December 18, 2024 21:49
@alvaro1080 alvaro1080 self-requested a review December 19, 2024 09:23
Copy link
Contributor

@alvaro1080 alvaro1080 left a comment

Choose a reason for hiding this comment

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

Thank you for this Pull Request! It is a really impressive feature, that will have a significant impact on the user experience. It is really coherent with the first objective of the app which was to make athletes train together!

I have a few comment that I would like to address. There is a certain number of ressources (colors and string) that are added and unused, I am not sure if it is for a latter update so I just want to highlight it.

Concerning the feature, I could not test is a 100% as is require 2 devices. I think it would be really beneficial if another reviewer could try this feature on 2 real devices. (I think that the author as already 2 devices so it should be already tested, but since we are at the end the project it is great to double check everything.)

Concerning the UI, I have a small detail that I would like to discuss on the screenshot bellow:

(Also if there is a way to change the background color of the pop up, as it is quite far from the rest of the app, but this just really a detail)

image

I think that the title "Choose Your Role" and the question that follows are a bit redundant, given that then the Athlete/coach changes when we tick the box. I think that we could either remove the title or the question (Or make the question become the title perhaps?)

val status = if (isAccepted) RequestStatus.ACCEPTED else RequestStatus.REJECTED
db.collection(PAIRING_REQUESTS).document(requestId).update("status", status.name).await()
override suspend fun updatePairingRequestStatus(requestId: String, status: RequestStatus) {
require(requestId.isNotEmpty()) { "The request ID must not be empty." }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: you could define a constant for this string, as it is also used in line 473 and line 486

import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.grid.items
Copy link
Contributor

Choose a reason for hiding this comment

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

Import: this unused import could be removed

}

// Utility to fetch activity icon
@Composable
Copy link
Contributor

Choose a reason for hiding this comment

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

Improvement: We have the same function in java/com/android/streetworkapp/ui/progress/Progression.kt at the end of the file. Since this function seems to be useful in many parts of the app, we should perhaps deplace it in a utility file and use it in the different parts of the app, rather than rewriting it each time

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I merge the two functions and put this function in the utils folder

@@ -3,6 +3,7 @@
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: I think(if I am not mistaken) that this color is unused, do you plan to use it later? If not perhaps we could remove it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed it was a mistake first I used purple_500 then purple_200 and I forgot to remove this color

<string name="time_activity_in_progress">The activity is time-based and currently in progress. Your coach manage the timer.</string>
<string name="reps_activity_in_progress">The activity is repetition-based and currently in progress. Your coach manage the counter.</string>
<string name="end_session_button_text">End session</string>
<string name="counter_as_coach">Counter as coach</string>
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above: this string is also unused, is it to keep it for a futur improvement? (it is also the case for some other strings in this file, if you would like to check)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

modifier = Modifier.fillMaxSize().padding(16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center) {
Text("No session data available.")
Copy link
Contributor

@alvaro1080 alvaro1080 Dec 19, 2024

Choose a reason for hiding this comment

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

Refactor: the string could be added to the string.xml file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch !

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
45.44% Line Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link
Contributor

@alvaro1080 alvaro1080 left a comment

Choose a reason for hiding this comment

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

Thank you for the update!

@tercierp tercierp merged commit 34396ec into main Dec 19, 2024
2 of 3 checks passed
@tercierp tercierp deleted the feat/training-coach-frontend-final branch December 19, 2024 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement a coach training (frontend)
2 participants