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

Generosity challenge - day 2 - assignment - select family values (kids-923) #711

Merged

Conversation

Daniela510
Copy link
Contributor

@Daniela510 Daniela510 commented May 2, 2024

Description

Overview of changes:

  • Added a DailyAssignmentCubit to keep track of assignments that have a flow between giving assignment and completion. Right now this is specifically about day 2 and day 7.
  • From design, day 2 and day 7 when the assignment card is split in 2 parts, the second part is filled in by user choices, on day 2 is the selected values on day 7 it will be a recap of the donation.
  • Also looking at the design it seems the banner mage will be the same every day, the top label is also static, and the banner title is the same as the assignment title so i removed the feedback fields as they seemed redundant.
  • The family values selection feature is in subfolder assignments & happens on a sub-route of the generosity challenge.

@github-actions github-actions bot added the enhancement New feature or request label May 2, 2024
@Daniela510 Daniela510 marked this pull request as ready for review May 2, 2024 16:02
@Daniela510 Daniela510 requested a review from a team as a code owner May 2, 2024 16:02
@Daniela510 Daniela510 changed the title Generosity challenge - day 2 - assignment - select family values (kids 923) Generosity challenge - day 2 - assignment - select family values (kids-923) May 2, 2024
@@ -11,6 +11,10 @@ enum Pages {
path: '/generosity-challenge',
name: 'GENEROSITY-CHALLENGE',
),
generositySelectValues(
path: 'select-values',
Copy link
Contributor

Choose a reason for hiding this comment

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

let's add "generosity-..." for consistency

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would reather remove generosity from the title to make it selectValues(path: 'select-values',) since it is on the generosity sub-route.

Copy link
Contributor

Choose a reason for hiding this comment

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

makes sense bc of sub route, I didn't think about it)

required this.area,
});

factory FamilyValue.fromJson(Map<String, dynamic> json) {
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps fromMap/toMap would be more consistent?

mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Select 3 values',
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we use FamilyValuesState.maxSelectedValues here?


mixin FamilyValuesRepository {
Future<bool> rememberValues({
required List<Map<String, dynamic>> body,
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we use map here instead of List?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its of list of maps because its a list of family values, i could wrap the list in a map to be something like:

{"values" : [
    { ...
    },
    { ...
    },
  ]
}

But i am not sure what would be the utility of that?

Copy link
Contributor

Choose a reason for hiding this comment

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

'Its of list of maps because its a list of family values' - yes, and that's ok. I think repository is a good place for data translation from model to map and to json string and backward instead of doing it in the cubit

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean this part:
final selectedValuesJson = state.selectedValues.map((e) => e.toMap()).toList();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ooh! Yes totally, thank you for the direction 🙏

@@ -12,21 +12,18 @@ class Task extends Equatable {
required this.description,
required this.onTap,
required this.buttonText,
required this.feedbackImage,
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest to keep feedback per day logic since it's already implemented and can be useful for upcoming challenges, even if we do not use it for the current one (I assume bc of simplification).

'day': challenge.state.detailedDayIndex + 1,
},
);
await challenge.completeActiveDay();
Copy link
Contributor

Choose a reason for hiding this comment

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

at this point I wanna ask why don't we use GenerosityChallengeCubit for it? Isn't DailyAssignmentCubit look redundant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to use smaller, more 'focused', but youu are right, one more GenerosityChallengeStatus would work as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

imagePath:
'https://givtstoragedebug.blob.core.windows.net/public/cdn/tag-logos/aid.svg',
colorCombo: ColorCombo.highlight,
interestKeys: ['AFTERADISASTER'],
Copy link
Contributor

Choose a reason for hiding this comment

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

let's put these values in enums for both interestKeys and area

Copy link
Contributor

@pavelpavelko pavelpavelko left a comment

Choose a reason for hiding this comment

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

Good job Daniela!

@Daniela510 Daniela510 merged commit 21a3a96 into develop May 3, 2024
1 check passed
@Daniela510 Daniela510 deleted the feature/kids-923-generosity-challenge-select-family-values branch May 3, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants