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

Cleanup remaining usages of getDetailsText() from TaskData #2950

Merged
merged 18 commits into from
Dec 27, 2024

Conversation

shobhitagarwal1612
Copy link
Member

@shobhitagarwal1612 shobhitagarwal1612 commented Dec 20, 2024

Fixes #1733

getDetailsText() was previously used for displaying value of response for the current task fragment. This method is extended by all response model classes (TaskData). All text should be created on view layer and not is model due to i18n.

In this PR, I've migrated all remaining usages of getDetailsText() with appropriate values and cleaned up all unused methods.

This is a pure refactor and doesn't change any existing user behavior.
Verified that this doesn't introduce any regressions via unit tests and manually running the app in an emulator.

@gino-m PTAL?

Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 62.25%. Comparing base (cdc6847) to head (ce8abd7).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...m/google/android/ground/ui/map/gms/ConverterExt.kt 0.00% 0 Missing and 2 partials ⚠️
.../firebase/schema/CaptureLocationResultConverter.kt 0.00% 1 Missing ⚠️
...ion/tasks/location/CaptureLocationTaskViewModel.kt 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2950      +/-   ##
============================================
+ Coverage     61.90%   62.25%   +0.35%     
+ Complexity     1204     1200       -4     
============================================
  Files           268      265       -3     
  Lines          6441     6419      -22     
  Branches        897      890       -7     
============================================
+ Hits           3987     3996       +9     
+ Misses         1898     1867      -31     
  Partials        556      556              
Files with missing lines Coverage Δ
...ndroid/ground/model/mutation/SubmissionMutation.kt 94.44% <ø> (+4.97%) ⬆️
...ground/model/submission/CaptureLocationTaskData.kt 100.00% <ø> (+50.00%) ⬆️
...ndroid/ground/model/submission/DateTimeTaskData.kt 33.33% <ø> (+4.76%) ⬆️
...ndroid/ground/model/submission/GeometryTaskData.kt 100.00% <100.00%> (+88.88%) ⬆️
.../ground/model/submission/MultipleChoiceTaskData.kt 76.92% <100.00%> (+12.40%) ⬆️
.../android/ground/model/submission/NumberTaskData.kt 28.57% <100.00%> (-8.93%) ⬇️
...e/android/ground/model/submission/PhotoTaskData.kt 20.00% <ø> (+3.33%) ⬆️
...android/ground/model/submission/SkippedTaskData.kt 50.00% <ø> (+10.00%) ⬆️
...google/android/ground/model/submission/TaskData.kt 100.00% <ø> (ø)
...le/android/ground/model/submission/TextTaskData.kt 16.66% <ø> (-20.84%) ⬇️
... and 10 more

... and 3 files with indirect coverage changes

@shobhitagarwal1612 shobhitagarwal1612 changed the title Cleanup remaining usages of getDetailsText() and move string creation to view layer Cleanup remaining usages of getDetailsText() from TastData Dec 20, 2024
Copy link
Collaborator

@gino-m gino-m left a comment

Choose a reason for hiding this comment

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

Ah, finally!!! I've dreamt of this moment for 2+ years 😆

Would it be possible to add tests to the ViewModelTests to check this presentation logic while you're at it?

@shobhitagarwal1612 shobhitagarwal1612 force-pushed the cleanup-taskData branch 2 times, most recently from b944ca7 to 0938f68 Compare December 22, 2024 10:55
@shobhitagarwal1612
Copy link
Member Author

Would it be possible to add tests to the ViewModelTests to check this presentation logic while you're at it?

Done. PTAL?

Copy link
Collaborator

@gino-m gino-m left a comment

Choose a reason for hiding this comment

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

LGTM, just a few more nits. Thanks!

@shobhitagarwal1612 shobhitagarwal1612 changed the title Cleanup remaining usages of getDetailsText() from TastData Cleanup remaining usages of getDetailsText() from TaskData Dec 25, 2024
Copy link
Collaborator

@gino-m gino-m left a comment

Choose a reason for hiding this comment

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

🥳

@gino-m gino-m merged commit 8c2bf78 into master Dec 27, 2024
5 checks passed
@gino-m gino-m deleted the cleanup-taskData branch December 27, 2024 17:04
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.

[Code health] Move creation of string labels for responses from model to view
2 participants