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

Reformat / Refactor of states in the discover Viewmodel #275

Merged
merged 9 commits into from
May 16, 2024

Conversation

JeremyHugentobler
Copy link
Contributor

@JeremyHugentobler JeremyHugentobler commented May 16, 2024

The issue

Previously, all the states and functions of the discoverscreen viewmodel were given as parameters to the screens using them. This made the code hard to read and maintain and had a negative impact on the general line coverage of the project. (Because the navgraph is almost untestable, adding lines there to initiate screens wasn't beneficial for us)

The solution

I fixed this for the discovery screen viewmodel by creating two data classes, one that stores all the states and one that stores all the functions called by screens. This took a lot of time to merge with main since a lot of PRs changed completely the content of certain files.

Tests

I tested as much as it was possible, but Sonar has a weird way of qualifying what is "new code". It counted in my additions a lot of part that I didn't really modify (the map screen) that blocks my line coverage at around 73. There is, for the moment, no possible ways to test this composable and since I did not change anything about it's functionalities, it should be fine and there is not much that I can do.
Additionaly, the modification I did improved the global line coverage of the project by 3%, which was already higher than 80% before.

Next

We should do that for all the viewmodel, but this time is really time consuming and comports some risks when merging

@JeremyHugentobler JeremyHugentobler linked an issue May 16, 2024 that may be closed by this pull request
@JeremyHugentobler JeremyHugentobler added this to the Milestone 3 milestone May 16, 2024
@JeremyHugentobler JeremyHugentobler self-assigned this May 16, 2024
Copy link

sonarcloud bot commented May 16, 2024

Copy link
Contributor

@ecornamu ecornamu left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@Andy130604 Andy130604 left a comment

Choose a reason for hiding this comment

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

You did some amazing changes! Maybe not so visually appealing but truly useful for everyone. Your coverage is not above 80% on new code but since you are using the map I guess it isn't testable. Everything else is tested Overall really good job. Keep it up :)

@JeremyHugentobler JeremyHugentobler merged commit b3f8342 into main May 16, 2024
3 checks passed
@JeremyHugentobler JeremyHugentobler deleted the reformatting/navgraph branch May 16, 2024 21:42
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.

NavGraphs adapted for taking less parameters
3 participants