-
Notifications
You must be signed in to change notification settings - Fork 120
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
Hide "Collect data" button when the job has no more tasks to complete #2598
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2598 +/- ##
============================================
- Coverage 57.86% 57.84% -0.03%
- Complexity 1379 1381 +2
============================================
Files 318 318
Lines 7191 7206 +15
Branches 892 896 +4
============================================
+ Hits 4161 4168 +7
- Misses 2511 2519 +8
Partials 519 519
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Thank you, @sufyanAbbasi ! Are missing tests easy to add, or should we disable these warnings for now? |
Unfortunately, the tests are really hard to add since we don't have any good Fragment or ViewModel tests on these components, just a small one that checks for the map type dialog opens. There's a ton we'd have to do get that fixed.... I have tested this locally on the emulator, if you'll at least believe that the crash won't happen. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Ack. Please stamp and merge #2610 and update this branch to rerun checks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it mean for a job to have no more tasks to complete? A job with no tasks is an invalid job and shouldn't be shown, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sufyanAbbasi On second thought - the correct thing to do would be to hide the "Add data" button altogether for jobs which only have a single addLoi task. Can you update this PR accordingly?
Good question, definitely we can/should workshop the UX a little bit here, as I was mostly going for the simplest solution possible. For all intents and purposes, there are tasks on the job, it's just that it's only the one LOI task, so if you are trying to submit to a pre-defined LOI task, then there are technically no MORE tasks on the job, hence the message. I think a survey organizer would be able to understand why their user saw that; they configured the survey to only have the LOI task so if they are trying to submit to a predefined task, there's nothing the user can do with that. I did see that it's possible to put the card in a read-only state, but it doesn't provide any feedback to the user about why they can't do anything with it. From a UX perspective, we prefer not to disable submit buttons, instead, let users click them and get feedback about why it doesn't work, and they can escalate to the survey organizers with a clear enough message. If you have any suggestions for a better error message, please let me know! |
It's quite clear imo - if your only task is to add an LOI (e.g, a survey where the users just need to drop pins on the map), "add data to an existing LOI" has no meaning, and as such it would be a bug to show the CTA in the UI. "No more tasks" would be confusing without context - "How do I get more tasks? Do I need to do something else? Or is this a bug"? Would it be hard to just remove it completely in these cases? |
…round-android into sufy/2539/task-sequence
Implemented the fix to remove the "Collect Data" button. I did keep the "No task" message even though now it's impossible to get to since the button doesn't render, but since we do the same thing for user permission, I figured it would be worth keeping around to prevent crashes. |
ground/src/main/java/com/google/android/ground/ui/datacollection/DataCollectionViewModel.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Please just update the PR desc before merging!
Fixes #2539
Don't start data collection and instead throw an error if there are not more valid tasks for the job.
startId
is not found.This state should be impossible but is nice to have to prevent crashes:
@shobhitagarwal1612 PTAL!