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

[Data Submission] Save timestamp when capturing current location #2719

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shobhitagarwal1612
Copy link
Member

@shobhitagarwal1612 shobhitagarwal1612 commented Sep 8, 2024

Towards #2717

@gino-m PTAL?

Copy link

codecov bot commented Sep 8, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 5 lines in your changes missing coverage. Please review.

Project coverage is 60.89%. Comparing base (7cffa80) to head (6530ec6).

Files with missing lines Patch % Lines
.../firebase/schema/CaptureLocationResultConverter.kt 0.00% 3 Missing ⚠️
...n/tasks/location/CaptureLocationTaskMapFragment.kt 33.33% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2719      +/-   ##
============================================
- Coverage     60.91%   60.89%   -0.03%     
- Complexity     1164     1165       +1     
============================================
  Files           265      265              
  Lines          6046     6053       +7     
  Branches        839      839              
============================================
+ Hits           3683     3686       +3     
- Misses         1893     1897       +4     
  Partials        470      470              
Files with missing lines Coverage Δ
...ground/model/submission/CaptureLocationTaskData.kt 55.00% <100.00%> (+5.00%) ⬆️
...stence/remote/firebase/protobuf/ModelToProtoExt.kt 81.37% <100.00%> (+0.18%) ⬆️
...ion/tasks/location/CaptureLocationTaskViewModel.kt 44.44% <100.00%> (ø)
...n/tasks/location/CaptureLocationTaskMapFragment.kt 58.82% <33.33%> (-7.85%) ⬇️
.../firebase/schema/CaptureLocationResultConverter.kt 0.00% <0.00%> (ø)

@@ -55,7 +56,7 @@ abstract class AbstractMapFragmentWithControls : AbstractMapContainerFragment()
viewLifecycleOwner.lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
getMapViewModel().location.collect {
val taskData = it?.toCaptureLocationResult()
val taskData = it?.toCaptureLocationResult(timestampMillis = Date().time)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we save the current time in two places, here and in the CaptureLocationTaskMapFragment?

@kenstershiro My initial intuition was that we should store timestamp when the user clicks "Capture Location" button, not when the OS gives a location update, which would usually be slightly sooner. The degenerate case would be if the OS stops giving location updates (no GPS signal, location services disabled) - in that case, would we want to capture the time "Capture location" was clicked, or the time the last location was known? Can you ask @lecrabe and @jo-spek?

Copy link
Member Author

Choose a reason for hiding this comment

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

We wanted the formatted lat/lng for the info card. Removed the dependency of CaptureLocationTaskData from this class and directly created the formatted location text.

Copy link
Member Author

Choose a reason for hiding this comment

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

Discussed with @jo-spek

His main concern is that no other task stores a timestamp. Putting this PR on hold until the discussion is finalized.

@shobhitagarwal1612 shobhitagarwal1612 marked this pull request as ready for review September 16, 2024 13:58
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.

2 participants