Skip to content

Commit

Permalink
Clear the checkup location if the user rejects data contribution
Browse files Browse the repository at this point in the history
  • Loading branch information
ferndot committed Mar 20, 2020
1 parent 9a28b93 commit ac4a8f9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/src/data/models/checkups.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ class Checkup {
this.id,
this.created,
dataContributionPreference,
location,
this.location,
subjectiveResponses,
vitalsResponses,
}) : dataContributionPreference = dataContributionPreference ?? true,
location = location ?? CheckupLocation(),
subjectiveResponses = subjectiveResponses ?? [],
vitalsResponses = vitalsResponses ?? [];

Expand Down
4 changes: 3 additions & 1 deletion lib/src/data/models/checkups.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/src/ui/screens/checkup/checkup_loaded_body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class _CheckupLoadedBodyState extends State<CheckupLoadedBody> {
context: context,
checkupState: checkupState,
updateFunction: (Checkup checkup) {
checkup.location.postalCode = postalCode;
checkup.location = CheckupLocation(postalCode: postalCode);
return checkup;
},
);
Expand Down
3 changes: 3 additions & 0 deletions lib/src/ui/screens/checkup/steps/intro.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class _IntroStepState extends State<IntroStep> {
Checkup checkup = checkupState.checkup;
checkup.dataContributionPreference = value;

// Make sure to clear location
checkup.location = null;

context
.bloc<CheckupBloc>()
.add(UpdateLocalCheckup(updatedCheckup: checkup));
Expand Down

0 comments on commit ac4a8f9

Please sign in to comment.