-
Notifications
You must be signed in to change notification settings - Fork 8
fix: mp-2329 / Update Goal Suggestion for User Who Has Already Lent #6524
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
Conversation
Adds the getCategoryLoansByYear to the useGoalData composable and applies template changes to dynamically determine the subheadings for both the NextYearGoalCard and the GoalSelector components based on the current year's women-category loans.
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.
Pull request overview
This PR enhances the goal-setting experience for users who have already made loans in the current year by displaying their year-to-date progress alongside goal suggestions. The implementation adds a new getCategoryLoansByYear function to the useGoalData composable and updates both NextYearGoalCard and GoalSelector components to dynamically adjust their messaging based on the user's current year lending activity.
Key changes:
- Added
getCategoryLoansByYearfunction to fetch tiered lending achievement progress for a specific year - Refactored
loadProgressto use the new shared function for better code reusability - Updated goal suggestion logic to adjust recommendations when current year loans exceed last year's total
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/composables/useGoalData.js | Adds getCategoryLoansByYear function for fetching yearly category loan data and refactors loadProgress to use it; exports the new function |
| src/components/MyKiva/NextYearGoalCard.vue | Loads and displays current year women's loans count to inform users of their progress when setting goals |
| src/components/MyKiva/GoalSetting/GoalSelector.vue | Dynamically updates subtitle text and goal suggestions based on current year lending activity, adjusting recommendations when users exceed last year's total |
Comments suppressed due to low confidence (1)
src/composables/useGoalData.js:266
- The refactored loadProgress function now calls getCategoryLoansByYear, but the error handling is problematic. If getCategoryLoansByYear returns null due to an error, this will set currentYearProgress.value to null instead of keeping its previous value. The catch block will never execute because getCategoryLoansByYear catches its own errors. Consider handling the null return value from getCategoryLoansByYear or let errors propagate to maintain consistent error handling behavior.
try {
const response = await apolloClient.query({ query: useGoalDataQuery, fetchPolicy });
const prefsData = response.data?.my?.userPreferences || null;
totalLoanCount.value = response.data?.my?.loans?.totalCount || 0;
userPreferences.value = prefsData;
return prefsData ? JSON.parse(prefsData.preferences || '{}') : {};
} catch (error) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
christian14b
left a comment
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.
Looks good! I have just one comment regarding currentYearProgress
|
🎉 This PR is included in version 3.48.0-rc.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 3.48.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Adds the
getCategoriesProgressByYearandgetCategoryLoanCountByYearto theuseGoalDatacomposable and applies template changes to dynamically determine the subheadings for both theNextYearGoalCardand theGoalSelectorcomponents based on the current year's women-category loans.