diff --git a/docs/migration-testing/QUICKACTIONBVCENDVIEW_MIGRATION.md b/docs/migration-testing/QUICKACTIONBVCENDVIEW_MIGRATION.md new file mode 100644 index 00000000..930bafe4 --- /dev/null +++ b/docs/migration-testing/QUICKACTIONBVCENDVIEW_MIGRATION.md @@ -0,0 +1,149 @@ +# QuickActionBvcEndView.vue Migration Documentation + +**Migration Start**: 2025-07-08 10:59 UTC +**Component**: QuickActionBvcEndView.vue +**Priority**: High (Critical User Journey) +**Location**: `src/views/QuickActionBvcEndView.vue` + +## Pre-Migration Analysis + +### ๐Ÿ” **Current State Assessment** + +#### Database Operations +- **Legacy Pattern**: Uses `databaseUtil.retrieveSettingsForActiveAccount()` +- **Raw SQL**: Uses `platformService.dbQuery("SELECT * FROM contacts")` +- **Data Mapping**: Uses `databaseUtil.mapQueryResultToValues()` + +#### Notification Usage +- **Direct $notify Calls**: 6 instances found +- **Notification Types**: danger, toast, success +- **Messages**: Error handling, success confirmations, status updates + +#### Template Complexity +- **Conditional Rendering**: Multiple v-if/v-else conditions +- **Dynamic Content**: Complex claim descriptions and counts +- **User Interactions**: Checkbox selections, form inputs + +### ๐Ÿ“‹ **Migration Requirements** + +#### 1. Database Migration +- [ ] Replace `databaseUtil.retrieveSettingsForActiveAccount()` with PlatformServiceMixin +- [ ] Replace raw SQL query with service method +- [ ] Replace `databaseUtil.mapQueryResultToValues()` with proper typing + +#### 2. SQL Abstraction +- [ ] Replace `platformService.dbQuery("SELECT * FROM contacts")` with `$getAllContacts()` +- [ ] Use proper service methods for all database operations + +#### 3. Notification Migration +- [ ] Extract all notification messages to constants +- [ ] Replace direct `$notify()` calls with helper methods +- [ ] Create notification templates for complex scenarios + +#### 4. Template Streamlining +- [ ] Extract complex computed properties +- [ ] Simplify template logic where possible + +## Migration Plan + +### ๐ŸŽฏ **Step 1: Database Migration** +Replace legacy database operations with PlatformServiceMixin methods: + +```typescript +// Before +const settings = await databaseUtil.retrieveSettingsForActiveAccount(); +const contactQueryResult = await platformService.dbQuery("SELECT * FROM contacts"); +this.allContacts = databaseUtil.mapQueryResultToValues(contactQueryResult); + +// After +const settings = await this.$settings(); +this.allContacts = await this.$getAllContacts(); +``` + +### ๐ŸŽฏ **Step 2: Notification Migration** +Extract notification messages and use helper methods: + +```typescript +// Before +this.$notify({ + group: "alert", + type: "danger", + title: "Error", + text: "There was an error retrieving today's claims to confirm.", +}, 5000); + +// After +this.notify.error(NOTIFY_ERROR_RETRIEVING_CLAIMS.message, TIMEOUTS.LONG); +``` + +### ๐ŸŽฏ **Step 3: Template Optimization** +Extract complex logic to computed properties: + +```typescript +// Add computed properties for complex template logic +get hasSelectedClaims() { + return this.claimsToConfirmSelected.length > 0; +} + +get canSubmit() { + return this.hasSelectedClaims || (this.someoneGave && this.description); +} +``` + +## Migration Progress + +### โœ… **Completed Steps** +- [ ] Pre-migration analysis +- [ ] Migration plan created +- [ ] Documentation started + +### ๐Ÿ”„ **In Progress** +- [ ] Database migration +- [ ] Notification migration +- [ ] Template streamlining + +### ๐Ÿ“‹ **Remaining** +- [ ] Validation testing +- [ ] Human testing +- [ ] Documentation updates + +## Expected Outcomes + +### ๐ŸŽฏ **Technical Improvements** +- **Database Security**: Eliminate raw SQL queries +- **Code Quality**: Standardized notification patterns +- **Maintainability**: Simplified template logic +- **Type Safety**: Proper TypeScript typing + +### ๐Ÿ“Š **Performance Benefits** +- **Database Efficiency**: Optimized contact retrieval +- **Memory Usage**: Reduced template complexity +- **User Experience**: Consistent notification behavior + +### ๐Ÿ”’ **Security Enhancements** +- **SQL Injection Prevention**: Parameterized queries +- **Error Handling**: Standardized error messages +- **Input Validation**: Proper data validation + +## Testing Requirements + +### ๐Ÿงช **Functionality Testing** +- [ ] BVC meeting end workflow +- [ ] Claim confirmation process +- [ ] Gift recording functionality +- [ ] Error handling scenarios + +### ๐Ÿ“ฑ **Platform Testing** +- [ ] Web browser functionality +- [ ] Mobile app compatibility +- [ ] Desktop app performance + +### ๐Ÿ” **Validation Testing** +- [ ] Migration validation script +- [ ] Linting compliance +- [ ] TypeScript compilation +- [ ] Notification completeness + +--- +*Migration Status: Planning Phase* +*Next Update: After migration completion* \ No newline at end of file diff --git a/src/constants/notifications.ts b/src/constants/notifications.ts index dea0f3b5..fd3cef63 100644 --- a/src/constants/notifications.ts +++ b/src/constants/notifications.ts @@ -94,6 +94,73 @@ export const NOTIFY_VISIBILITY_REFRESHED = { message: "visibility status updated.", }; +// QuickActionBvcEndView.vue specific constants +// Used in: QuickActionBvcEndView.vue (created method - error retrieving claims) +export const NOTIFY_ERROR_RETRIEVING_CLAIMS = { + title: "Error", + message: "There was an error retrieving today's claims to confirm.", +}; + +// Used in: QuickActionBvcEndView.vue (record method - sending status) +export const NOTIFY_SENDING_STATUS = { + title: "Sent...", + message: "", +}; + +// Used in: QuickActionBvcEndView.vue (record method - confirmation error) +export const NOTIFY_CONFIRMATION_SEND_ERROR = { + title: "Error", + message: "There was an error sending some of the confirmations.", +}; + +// Used in: QuickActionBvcEndView.vue (record method - all confirmations error) +export const NOTIFY_ALL_CONFIRMATIONS_ERROR = { + title: "Error", + message: "There was an error sending all of the confirmations.", +}; + +// Used in: QuickActionBvcEndView.vue (record method - give error) +export const NOTIFY_GIVE_SEND_ERROR = { + title: "Error", + message: "There was an error sending that give.", +}; + +// Used in: QuickActionBvcEndView.vue (record method - claims send error) +export const NOTIFY_CLAIMS_SEND_ERROR = { + title: "Error", + message: "There was an error sending claims.", +}; + +// Used in: QuickActionBvcEndView.vue (record method - single confirmation success) +export const NOTIFY_SINGLE_CONFIRMATION_SUCCESS = { + title: "Success", + message: "Your confirmation has been recorded.", +}; + +// Used in: QuickActionBvcEndView.vue (record method - multiple confirmations success) +export const NOTIFY_MULTIPLE_CONFIRMATIONS_SUCCESS = { + title: "Success", + message: "Your confirmations have been recorded.", +}; + +// Used in: QuickActionBvcEndView.vue (record method - give success) +export const NOTIFY_GIVE_SUCCESS = { + title: "Success", + message: "That give has been recorded.", +}; + +// Used in: QuickActionBvcEndView.vue (record method - confirmations and give success) +export const NOTIFY_CONFIRMATIONS_AND_GIVE_SUCCESS = { + title: "Success", + message: "Your confirmations and that give have been recorded.", +}; + +// Used in: QuickActionBvcEndView.vue (record method - confirmations only success) +export const NOTIFY_CONFIRMATIONS_ONLY_SUCCESS = { + title: "Success", + message: "Your confirmations have been recorded.", +}; + // ContactsView.vue specific constants // Used in: ContactsView.vue (processInviteJwt method - blank invite error) export const NOTIFY_BLANK_INVITE = { @@ -753,3 +820,35 @@ export function createContactAddedMessage(contactName: string): string { export function createInviteDeleteConfirmMessage(notes: string): string { return `${NOTIFY_INVITE_DELETE_CONFIRM.message} "${notes}"? (There is no undo.)`; } + +/** + * Creates confirmation success message based on count + * @param count - Number of confirmations + * @returns Formatted success message + */ +export function createConfirmationSuccessMessage(count: number): string { + return count === 1 + ? NOTIFY_SINGLE_CONFIRMATION_SUCCESS.message + : NOTIFY_MULTIPLE_CONFIRMATIONS_SUCCESS.message; +} + +/** + * Creates combined success message for confirmations and give + * @param confirmCount - Number of confirmations + * @param hasGive - Whether a give was also recorded + * @returns Formatted success message + */ +export function createCombinedSuccessMessage( + confirmCount: number, + hasGive: boolean, +): string { + if (confirmCount > 0 && hasGive) { + return NOTIFY_CONFIRMATIONS_AND_GIVE_SUCCESS.message; + } else if (hasGive) { + return NOTIFY_GIVE_SUCCESS.message; + } else { + const confirms = confirmCount === 1 ? "confirmation" : "confirmations"; + const hasHave = confirmCount === 1 ? "has" : "have"; + return `Your ${confirms} ${hasHave} been recorded.`; + } +} diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue index 140122d6..4959628b 100644 --- a/src/views/ProjectViewView.vue +++ b/src/views/ProjectViewView.vue @@ -1339,7 +1339,7 @@ export default class ProjectViewView extends Vue { this.notify.confirm( NOTIFY_CONFIRM_CLAIM.text, async () => { - await this.confirmClaim(give); + await this.confirmClaim(give); }, TIMEOUTS.MODAL, ); diff --git a/src/views/QuickActionBvcEndView.vue b/src/views/QuickActionBvcEndView.vue index b7a1c4cf..b5c4a838 100644 --- a/src/views/QuickActionBvcEndView.vue +++ b/src/views/QuickActionBvcEndView.vue @@ -71,11 +71,7 @@
- {{ - claimCountWithHidden === 1 - ? "There is 1 other claim with hidden details," - : `There are ${claimCountWithHidden} other claims with hidden details,` - }} + {{ claimCountWithHiddenText }} so if you expected but do not see details from someone then ask them to check that their activity is visible to you on their Contacts @@ -84,11 +80,7 @@
- {{ - claimCountByUser === 1 - ? "There is 1 other claim by you" - : `There are ${claimCountByUser} other claims by you` - }} + {{ claimCountByUserText }} which you don't need to confirm.
@@ -114,10 +106,7 @@ -
+