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

#2245 - Make non-monetary contribution mandatory in IncomeDetails.vue for non-pledgers #2292

Merged
merged 10 commits into from
Aug 14, 2024

Conversation

SebinSong
Copy link
Collaborator

closes #2245

Adding below block to IncomeDetails.vue

@taoeffect
Please let me know if you would like to change the validation copy.

@SebinSong SebinSong self-assigned this Aug 8, 2024
Comment on lines +1087 to +1089
case 'nonMonetaryReplace':
groupProfile.nonMonetaryContributions = cloneDeep(value)
break
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Adding this feature requires a way to update groupProfile.nonMonetaryContributions array as a whole instead of element by element. So adding nonMonetaryReplace here.

Comment on lines 128 to 132
pledges: {
[L('At least one non-monetary pledge is required')]: (value) => {
return this.optional ||
(value?.length && value.some(entry => entry.value))
},
Copy link
Collaborator Author

@SebinSong SebinSong Aug 8, 2024

Choose a reason for hiding this comment

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

No need to validate this component when non-monetary contribution is optional. So implementing a custom validator here.

Copy link

cypress bot commented Aug 8, 2024



Test summary

111 0 10 0


Run details

Project group-income
Status Passed
Commit 874ff02 ℹ️
Started Aug 8, 2024 11:54 PM
Ended Aug 9, 2024 12:05 AM
Duration 10:38 💡
OS Linux Ubuntu - 20.04
Browser Electron 89

View run in Cypress Cloud ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Cloud

Copy link
Member

@taoeffect taoeffect left a comment

Choose a reason for hiding this comment

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

Fantastic work @SebinSong!

This is just a comment / question for you before approval.

return {
form: {
pledges: [
{ id: randomHexString(10), value: '' }
Copy link
Member

Choose a reason for hiding this comment

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

Is this id thing necessary? If all it's used for is is the :key in the v-for, then can't the position (index) in the array be used instead?

Copy link
Collaborator Author

@SebinSong SebinSong Aug 12, 2024

Choose a reason for hiding this comment

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

@taoeffect Can we keep this as is? We have a feature to add/remove an array item here and in this case, having unique id like this can help prevent duplicated keys from being generated accidentally.

Copy link
Member

Choose a reason for hiding this comment

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

yeah, I was was just trying to understand why it was necessary

Comment on lines +7 to +8
i18n.is-title-4 Non-monetary pledge
i18n.c-optional(v-if='optional') (optional)
Copy link
Member

Choose a reason for hiding this comment

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

Note: typically I'd request that these be made two complete sentence using a computed property, however, I see that in the UI they are visually separate elements, so this is OK.

Copy link
Member

@taoeffect taoeffect left a comment

Choose a reason for hiding this comment

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

Great work!

@taoeffect taoeffect merged commit 249e3c3 into master Aug 14, 2024
4 checks passed
@taoeffect taoeffect deleted the sebin/task/#2245-require-non-monetary-contribution branch August 14, 2024 03:43
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.

Require non-monetary contributions for those making less than mincome
2 participants