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

fix(templates): update midweek schedule and assignment slips #3132

Merged
merged 7 commits into from
Dec 3, 2024

Conversation

rhahao
Copy link
Member

@rhahao rhahao commented Dec 3, 2024

No description provided.

Copy link
Contributor

coderabbitai bot commented Dec 3, 2024

Walkthrough

This pull request introduces a variety of changes across multiple components and hooks within the codebase. Key modifications include updates to styling properties for layout adjustments in components like InfoMessage, Snackbar, and PersonBasicInfo. Enhancements to hooks such as useStartup, useBaptizedPublisher, and useFirstReport improve error handling and data management. Additionally, new filtering logic is implemented in several hooks to refine data handling based on date comparisons. Overall, the changes focus on improving layout, enhancing functionality, and refining data management without altering core logic.

Changes

File Path Change Summary
src/components/info-message/index.tsx Added minWidth: '280px' to Box, updated Button sx prop with marginLeft: '24px'.
src/components/snackbar/index.tsx Added left, right, and transform styles to center Snackbar, removed width from message class.
src/constants/table_encryption_map.ts Added first_report: 'shared' to persons object in TABLE_ENCRYPTION_MAP.
src/features/app_start/vip/startup/index.tsx Updated WaitingLoader to include variant prop with value "standard".
src/features/app_start/vip/startup/useStartup.tsx Added useFirebaseAuth import, improved error handling in runStartupCheck function.
src/features/meetings/my_assignments/useAssignments.ts Changed date filtering logic from toISOString() to formatDate().
src/features/meetings/weekly_schedules/midweek_meeting/useMidweekMeeting.tsx Added date filtering logic using addMonths for filteredSchedules.
src/features/meetings/weekly_schedules/week_selector/useWeekSelector.tsx Added JWLangState for language filtering, updated logic to use filteredSources.
src/features/meetings/weekly_schedules/weekend_meeting/useWeekendMeeting.tsx Added date filtering logic using addMonths for filteredSchedules.
src/features/persons/basic_info/index.tsx Added minHeight: '28px' to the first Box component.
src/features/persons/spiritual_status/baptized_publisher/useBaptizedPublisher.tsx Added useFirstReport import, updated logic for handling baptism history.
src/features/persons/spiritual_status/first_report/useFirstReport.tsx Changed handleChangeFirstReport to synchronous, added updateFirstReport function.
src/features/persons/spiritual_status/unbaptized_publisher/useUnbaptizedPublisher.tsx Added useFirstReport import, updated history management logic.
src/migration/admin_user/index.jsx Updated JSX formatting, added Divider components, and modified Stack styling.
src/pages/dashboard/useDashboard.tsx Removed dbAppSettingsUpdate, replaced with formatDate for date handling.
src/services/app/persons.ts Added early return statements in archiving functions, modified start_date logic.
src/services/app/schedules.ts Corrected variable names for student and assistant assignments.
src/services/dexie/schema.ts Updated interval value in user_settings schema from 5 to 15.
src/views/meetings/midweek/S140/app_normal/index.tsx Added counselor prop to S140Hall component conditionally.
src/views/meetings/midweek/S89/4in1/index.tsx Modified field prop in S89DetailsRow to change student name label format.
src/views/meetings/midweek/S89/default/index.tsx Changed field prop in S89DetailsRow to include a colon in the label.

Possibly related PRs


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@rhahao rhahao linked an issue Dec 3, 2024 that may be closed by this pull request
Copy link

netlify bot commented Dec 3, 2024

Deploy Preview for staging-organized ready!

Name Link
🔨 Latest commit dd5d7c4
🔍 Latest deploy log https://app.netlify.com/sites/staging-organized/deploys/674f4c1b592cff0008f91153
😎 Deploy Preview https://deploy-preview-3132--staging-organized.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

sonarqubecloud bot commented Dec 3, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
2 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
10.8% Duplication on New Code

See analysis details on SonarQube Cloud

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (12)
src/views/meetings/midweek/S89/default/index.tsx (1)

38-38: Consider consistent field label formatting.

While most fields follow the pattern ${t('key')}:, the part number field uses a different pattern t('tr_partNo'). Consider making the formatting consistent across all fields.

-              <S89DetailsRow field={t('tr_partNo')} value={data.part_number} />
+              <S89DetailsRow field={`${t('tr_partNo')}:`} value={data.part_number} />

Also applies to: 47-47

src/views/meetings/midweek/S89/4in1/index.tsx (1)

60-60: Consider consistent field label formatting across templates.

Similar to the default template, consider updating the part number field to match the colon-suffix pattern used by other fields.

-                            field={t('tr_partNo')}
+                            field={`${t('tr_partNo')}:`}

Also applies to: 75-75

src/migration/admin_user/index.jsx (1)

56-61: Consider using theme tokens for consistency

The Stack's styling uses hardcoded values for border, radius, and padding. Consider using theme tokens for better maintainability.

-    borderRadius="10px"
-    border="1px solid red"
-    padding="10px"
+    borderRadius={theme.shape.borderRadius}
+    border={`1px solid ${theme.palette.error.main}`}
+    padding={theme.spacing(1.25)}
src/components/info-message/index.tsx (2)

72-72: Consider using theme-based sizing

The hardcoded minWidth value could be derived from theme breakpoints or a design system token for consistency.

-          minWidth: '280px',
+          minWidth: theme.breakpoints.values.xs,  // or appropriate theme token

108-108: Consider using theme spacing

The button margin could use theme spacing units for consistency with the rest of the application.

-            sx={{ minHeight: '44px', marginLeft: '24px' }}
+            sx={{ minHeight: '44px', marginLeft: theme.spacing(3) }}
src/features/persons/spiritual_status/first_report/useFirstReport.tsx (1)

100-133: Consider optimizing the date filtering logic

The function correctly updates the first report based on the earliest start date, but the implementation could be more efficient.

Consider this optimization:

   const updateFirstReport = (newPerson: PersonType) => {
-    const baptizedHistory =
-      newPerson.person_data.publisher_baptized.history.filter(
-        (record) => !record._deleted && record.start_date !== null
-      );
-
-    const unbaptizedHistory =
-      newPerson.person_data.publisher_unbaptized.history.filter(
-        (record) => !record._deleted && record.start_date !== null
-      );
-
-    const history = baptizedHistory.concat(unbaptizedHistory);
+    const history = [
+      ...newPerson.person_data.publisher_baptized.history,
+      ...newPerson.person_data.publisher_unbaptized.history
+    ].filter(record => !record._deleted && record.start_date !== null);

     if (history.length === 0) return;

-    const minDate = history
-      .sort((a, b) => a.start_date.localeCompare(b.start_date))
-      .at(0).start_date;
+    const minDate = history.reduce(
+      (min, record) => record.start_date < min ? record.start_date : min,
+      history[0].start_date
+    );
src/features/meetings/my_assignments/useAssignments.ts (1)

54-57: Consider caching formatted dates

While the change to use formatDate improves consistency, formatting the same dates multiple times could impact performance.

Consider caching the formatted dates:

+    const formattedNow = formatDate(now, 'yyyy/MM/dd');
+    const formattedMaxDate = formatDate(maxDate, 'yyyy/MM/dd');

     let personAssignments = assignmentsHistory.filter(
       (record) =>
         (record.assignment.person === userUID ||
           delegateMembers.includes(record.assignment.person)) &&
-        formatDate(new Date(record.weekOf), 'yyyy/MM/dd') >=
-          formatDate(now, 'yyyy/MM/dd') &&
-        formatDate(new Date(record.weekOf), 'yyyy/MM/dd') <=
-          formatDate(maxDate, 'yyyy/MM/dd')
+        formatDate(new Date(record.weekOf), 'yyyy/MM/dd') >= formattedNow &&
+        formatDate(new Date(record.weekOf), 'yyyy/MM/dd') <= formattedMaxDate
     );
src/features/persons/spiritual_status/unbaptized_publisher/useUnbaptizedPublisher.tsx (1)

124-133: Consider simplifying the date handling logic

The null handling is good, but the code could be more concise.

Consider this simpler implementation:

-    if (value === null) {
-      current.start_date = null;
-    }
-
-    if (value !== null) {
-      const startMonth = dateFirstDayMonth(value).toISOString();
-      current.start_date = startMonth;
-    }
+    current.start_date = value ? dateFirstDayMonth(value).toISOString() : null;
src/features/meetings/weekly_schedules/midweek_meeting/useMidweekMeeting.tsx (1)

51-55: Consider adding a way to access historical schedules.

While filtering schedules to the last 2 months improves performance and focuses on relevant data, users might occasionally need to access older schedules. Consider adding a mechanism (e.g., a "View Historical Schedules" button) to access schedules older than 2 months when needed.

src/features/app_start/vip/startup/useStartup.tsx (1)

72-87: Enhance error logging

While the try-catch block is a good addition, consider adding more context to the error logging.

- console.error(error);
+ console.error('Startup check failed:', error);
+ console.error('Current state:', { isOfflineOverride, congName });
src/features/persons/spiritual_status/baptized_publisher/useBaptizedPublisher.tsx (2)

81-92: Document first report update logic

Consider adding a comment explaining why the first report needs to be updated when adding history.

+ // Update first report to reflect the earliest start date in the publisher's history
  updateFirstReport(newPerson);

127-135: Simplify start date assignment

The code can be more concise while maintaining the same functionality.

- if (value === null) {
-   current.start_date = null;
- }
-
- if (value !== null) {
-   const startMonth = dateFirstDayMonth(value).toISOString();
-   current.start_date = startMonth;
- }
+ current.start_date = value ? dateFirstDayMonth(value).toISOString() : null;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c78b51e and dd5d7c4.

📒 Files selected for processing (21)
  • src/components/info-message/index.tsx (2 hunks)
  • src/components/snackbar/index.tsx (1 hunks)
  • src/constants/table_encryption_map.ts (1 hunks)
  • src/features/app_start/vip/startup/index.tsx (1 hunks)
  • src/features/app_start/vip/startup/useStartup.tsx (3 hunks)
  • src/features/meetings/my_assignments/useAssignments.ts (1 hunks)
  • src/features/meetings/weekly_schedules/midweek_meeting/useMidweekMeeting.tsx (3 hunks)
  • src/features/meetings/weekly_schedules/week_selector/useWeekSelector.tsx (3 hunks)
  • src/features/meetings/weekly_schedules/weekend_meeting/useWeekendMeeting.tsx (3 hunks)
  • src/features/persons/basic_info/index.tsx (1 hunks)
  • src/features/persons/spiritual_status/baptized_publisher/useBaptizedPublisher.tsx (8 hunks)
  • src/features/persons/spiritual_status/first_report/useFirstReport.tsx (3 hunks)
  • src/features/persons/spiritual_status/unbaptized_publisher/useUnbaptizedPublisher.tsx (6 hunks)
  • src/migration/admin_user/index.jsx (3 hunks)
  • src/pages/dashboard/useDashboard.tsx (2 hunks)
  • src/services/app/persons.ts (3 hunks)
  • src/services/app/schedules.ts (1 hunks)
  • src/services/dexie/schema.ts (1 hunks)
  • src/views/meetings/midweek/S140/app_normal/index.tsx (1 hunks)
  • src/views/meetings/midweek/S89/4in1/index.tsx (1 hunks)
  • src/views/meetings/midweek/S89/default/index.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/features/persons/basic_info/index.tsx
🔇 Additional comments (24)
src/views/meetings/midweek/S89/default/index.tsx (1)

38-38: Verify translation key availability.

The change from tr_nameS89 to tr_name looks good as it follows the pattern used by other fields, but we should verify that the tr_name translation key exists.

✅ Verification successful

Translation key change is safe to use

The tr_name translation key exists in both profile and is actively used across multiple components including S89 templates (both default and 4in1 variants). The key is properly translated in all language files and follows a consistent usage pattern where components append the colon when needed. The removal of the specific tr_nameS89 in favor of the common tr_name key improves translation consistency.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for tr_name and tr_nameS89 usage in translation files
rg "tr_name[^a-zA-Z]" --type json
rg "tr_nameS89" --type json

Length of output: 1943


Script:

#!/bin/bash
# Let's check if tr_name is also defined in the meetings namespace
rg '"tr_name":' src/locales/*/meetings.json

# Also check if there are any other translation files that might contain tr_name
fd meetings.json --exec rg -l '"tr_name":'

# Check the actual usage context of tr_name in the codebase
rg "t\(['\"]tr_name['\"]" -A 2 -B 2

Length of output: 6770

src/views/meetings/midweek/S89/4in1/index.tsx (1)

60-60: LGTM! Change maintains consistency with default template.

The modification to use ${t('tr_name')}: matches the change in the default template, ensuring consistent behavior across both views.

src/features/app_start/vip/startup/index.tsx (1)

28-28: LGTM! Verify WaitingLoader prop types.

The addition of variant="standard" to WaitingLoader appears correct.

✅ Verification successful

Props verification completed - WaitingLoader accepts 'standard' variant

The WaitingLoader component accepts a variant prop that can be either 'fixed' or 'standard' as defined in the VariantProps type, so the usage of variant="standard" is valid.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify WaitingLoader component accepts these props
ast-grep --pattern 'interface $_ {
  type?: $_
  variant?: $_
}'

Length of output: 66


Script:

#!/bin/bash
# Let's try a broader search for WaitingLoader component definition and its props
ast-grep --pattern 'const WaitingLoader = $_'

# Also search for any WaitingLoader type definitions
ast-grep --pattern 'type WaitingLoader$_ = $_'

# And search for prop interfaces that might be named differently
rg -A 5 "WaitingLoader.*Props" 

Length of output: 2380


Script:

#!/bin/bash
# Let's find the VariantProps type definition in the same file
rg -A 5 "type VariantProps" src/components/waiting_loader/index.tsx

# Also check for any interface definitions in the same file
rg -A 5 "interface.*Props" src/components/waiting_loader/index.tsx

Length of output: 138


Script:

#!/bin/bash
# Let's try to get the entire content of the file to see type definitions
cat src/components/waiting_loader/index.tsx

# Also search for any type imports that might define these props
rg "import.*type.*Props.*from" src/components/waiting_loader/index.tsx

Length of output: 1194


Script:

#!/bin/bash
# Let's check the types file that's being imported
cat src/components/waiting_loader/index.types.ts

Length of output: 386

src/pages/dashboard/useDashboard.tsx (2)

46-48: Verify removal of settings update functionality.

The handleCloseNewCongNotice function no longer updates congregation settings. Ensure this change is intentional and doesn't break any requirements.

✅ Verification successful

Let me check the previous implementation of handleCloseNewCongNotice to see if it used dbAppSettingsUpdate.

Let me also check the current usage of this function:


Let me check if there's any other component that handles the congregation settings update when this notice is closed.


Let me check the actual Dashboard component and its relationship with the notice.


Based on the gathered information, I can now provide the final response:

Removal of settings update is correct and intentional

The handleCloseNewCongNotice function's simplification is correct. The congregation settings update (cong_settings.cong_new) is now handled in dedicated components:

  • useInitialSetup handles this in src/features/dashboard/initial_setup/useInitialSetup.tsx
  • usePersonRecord handles this in src/features/dashboard/initial_setup/person_record/usePersonRecord.tsx

The snack notification is now purely for UI state management, while the actual settings update is properly encapsulated in the initialization flow components.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for other usages of dbAppSettingsUpdate
rg "dbAppSettingsUpdate"

Length of output: 15019


Script:

#!/bin/bash
# Search for git history of handleCloseNewCongNotice function
git log -L :handleCloseNewCongNotice:src/pages/dashboard/useDashboard.tsx

Length of output: 0


Script:

#!/bin/bash
# Search for usages of handleCloseNewCongNotice and newCongSnack
rg "handleCloseNewCongNotice|newCongSnack" src/pages/dashboard/useDashboard.tsx -A 2 -B 2

Length of output: 529


Script:

#!/bin/bash
# Search for components that handle new congregation notice/settings
rg "cong_settings.cong_new" -A 3 -B 3

# Also check the Dashboard component to see how newCongSnack is used
rg "newCongSnack" src/pages/dashboard/Dashboard.tsx -A 3 -B 3

Length of output: 7248


Script:

#!/bin/bash
# Find and check the Dashboard component implementation
fd "Dashboard.tsx" --type f
rg "handleCloseNewCongNotice|newCongSnack" --type tsx -A 3 -B 3

Length of output: 158


35-40: Verify date format consistency across the application.

The change to use formatDate with 'yyyy/MM/dd' format affects assignment filtering logic. Ensure this format is consistently used across all date comparisons.

✅ Verification successful

Based on the search results, I can see that the formatDate function is used consistently across the codebase with specific format patterns:

  1. 'yyyy/MM/dd' - For full date comparisons (as in the reviewed code)
  2. 'yyyy/MM' - For month-based comparisons
  3. Other formats like 'HH:mm', shortDateFormat, etc. for specific display purposes

The date format 'yyyy/MM/dd' used in the reviewed code is consistent with other date comparison operations in the codebase, particularly when filtering records by date. Let's verify the implementation of the formatDate function to ensure it handles these formats correctly.


Let's try a different approach to find the formatDate implementation:


Let's check the implementation of dateFormat since it's the underlying function being used:


Based on the comprehensive analysis of the codebase, I can now provide the final response:

Date format usage is consistent and correctly implemented

The date formatting in the reviewed code is consistent with the rest of the codebase. The formatDate function is a wrapper around date-fns format function, and the 'yyyy/MM/dd' format is consistently used across the codebase for date comparisons, particularly in filtering operations. The implementation in useDashboard.tsx follows this established pattern, ensuring consistent date handling throughout the application.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for consistent date format usage
rg -A 2 "formatDate\(" | grep -v "yyyy/MM/dd"

Length of output: 27881


Script:

#!/bin/bash
# Check formatDate implementation
ast-grep --pattern 'function formatDate' -A 10

Length of output: 48


Script:

#!/bin/bash
# Search for formatDate export or declaration
rg "export.+formatDate|const formatDate|function formatDate" -A 5

Length of output: 496


Script:

#!/bin/bash
# Look for dateFormat implementation and imports
rg "import.*dateFormat|const dateFormat|function dateFormat" -A 5

Length of output: 5127

src/features/meetings/weekly_schedules/week_selector/useWeekSelector.tsx (3)

Line range hint 65-71: Improved type safety in useEffect.

The change from falsy check to strict boolean comparison (value === false) improves type safety.


25-29: Consider performance implications of filtering.

The introduction of filteredSources reduces the dataset to the last 2 months, which is good for performance. However, verify that this doesn't affect any requirements for viewing historical data.

✅ Verification successful

Let me analyze the other components that filter the sources:

  1. useWeekRangeSelector.tsx:

    • Filters sources from current week onwards
    • Has separate filters for start week and end week selection
  2. useScheduleRangeSelector.tsx:

    • Filters sources from current week onwards
  3. useSchedulePublish.tsx:

    • Uses a pastDate variable to filter sources
    • Let's check how this pastDate is calculated

Filtering to last 2 months is safe and aligned with other components

The 2-month filtering in useWeekSelector is appropriate as other components either:

  • Filter from current week onwards (useWeekRangeSelector, useScheduleRangeSelector)
  • Use a 3-month historical window (useSchedulePublish with -3 months)

The new 2-month filter maintains a good balance between performance and data availability, being well within the bounds of the most permissive component (3 months history in publish feature).

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for other components that might need historical data
rg -A 3 "sources\.filter"

Length of output: 2141


Script:

#!/bin/bash
# Check how pastDate is calculated in useSchedulePublish
ast-grep --pattern 'const pastDate = $_'

Length of output: 153


42-44: Verify language-specific filtering logic.

The midweek meeting filtering now depends on language-specific week dates. Ensure this change aligns with the PR objective to update midweek schedules.

✅ Verification successful

Let me gather more context about the PR objective and related changes.


Let me check the midweek meeting related changes to understand the context better.


Based on the gathered context, I can now provide the final response:

Language-specific filtering is correctly implemented and aligns with PR changes

The language-dependent filtering of midweek meetings is part of broader changes that include:

  • Consistent date filtering across components (limiting to 2 months)
  • Proper handling of week dates in both midweek meetings and week selector
  • The filtering logic correctly uses week_date_locale[lang] which is used consistently across multiple components
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for similar language-dependent filtering
rg -A 2 "week_date_locale\["

Length of output: 2050


Script:

#!/bin/bash
# Check PR files for midweek schedule related changes
git diff --name-only HEAD~1

# Look for type definitions or interfaces related to midweek meetings
ast-grep --pattern 'interface $_MidweekMeeting {
  $$$
  week_date_locale: $$$
  $$$
}'

# Check for any recent changes in filtering logic
git diff HEAD~1 src/features/meetings/weekly_schedules/week_selector/useWeekSelector.tsx

Length of output: 2881


Script:

#!/bin/bash
# Check changes in midweek meeting component
git diff HEAD~1 src/features/meetings/weekly_schedules/midweek_meeting/useMidweekMeeting.tsx

# Look for any tests related to week date locale filtering
rg -l "week_date_locale.*test" 

# Check the dashboard changes to understand the broader context
git diff HEAD~1 src/pages/dashboard/useDashboard.tsx

Length of output: 3158

src/migration/admin_user/index.jsx (1)

50-54: LGTM! Visual separation improves readability

The addition of Dividers before and after ActionSteps improves content hierarchy and visual organization.

src/components/snackbar/index.tsx (1)

72-74: LGTM! Proper horizontal centering implementation

The implementation uses the recommended CSS approach for horizontal centering (left 50% + transform). This ensures consistent positioning across different screen sizes.

src/components/info-message/index.tsx (1)

Line range hint 1-1: PR title may need updating

The changes in these files focus on UI improvements (layout, styling, positioning) rather than updates to midweek schedule and assignment slips as suggested by the PR title. Consider updating the PR title to better reflect the actual changes.

src/features/persons/spiritual_status/first_report/useFirstReport.tsx (2)

135-135: LGTM! Appropriate hook interface

The addition of updateFirstReport to the hook's return value is appropriate and maintains good encapsulation.


Line range hint 16-99: LGTM! Verify history record creation

The synchronous conversion and date handling logic look correct. The function properly handles edge cases and creates appropriate history records.

Let's verify the history record creation logic:

✅ Verification successful

The previous pattern might have been too strict. Let's try a more flexible pattern to catch variations in the history record creation, and also use ripgrep as a backup to find any history modifications.


LGTM! History record creation is consistent

The history record creation in useFirstReport.tsx follows the same pattern used throughout the codebase. All history records consistently include:

  • Generated UUID
  • _deleted: false flag
  • updatedAt timestamp
  • start_date and end_date fields
  • Same structure for both baptized and unbaptized publishers
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other places where history records are created to ensure consistency
ast-grep --pattern 'history.push({
  id: $_,
  _deleted: false,
  updatedAt: $_,
  start_date: $_,
  end_date: $_
})'

Length of output: 119


Script:

#!/bin/bash
# Let's try a more flexible pattern to find history record creations
ast-grep --pattern 'history.push({
  $$$
  _deleted: false,
  $$$
  start_date: $_,
  end_date: $_
  $$$
})'

# Also search for direct history modifications
rg "history\.(push|unshift)" -A 5

Length of output: 8410

src/features/persons/spiritual_status/unbaptized_publisher/useUnbaptizedPublisher.tsx (3)

9-17: LGTM! Good hook composition

The integration of useFirstReport is clean and maintains good separation of concerns.


67-67: LGTM! First report update is properly placed

The updateFirstReport call is correctly placed after person state changes.


88-89: LGTM! Consistent first report updates

The updateFirstReport calls are consistently placed after state changes in both handlers, maintaining data consistency.

Also applies to: 112-113

src/constants/table_encryption_map.ts (1)

24-24: LGTM! The encryption level is appropriate.

The addition of first_report with 'shared' access level aligns well with other publisher-related fields in the persons object.

src/features/meetings/weekly_schedules/midweek_meeting/useMidweekMeeting.tsx (1)

60-60: Verify schedule navigation behavior.

The switch to using filteredSchedules for navigation could affect users trying to access schedules at the boundary of the 2-month filter. Ensure that the navigation behavior remains smooth when:

  1. Users reach the oldest available schedule
  2. New schedules are added
  3. Schedules transition out of the 2-month window

Also applies to: 186-188

✅ Verification successful

Let me gather more information about the schedule filtering and navigation logic.


Let me gather one final piece of information about the navigation implementation.


Let me check one final aspect about the week selector implementation.


Based on the code analysis, I can now generate the final response:

Schedule navigation is properly handled with boundary safeguards

The implementation includes several safety mechanisms:

  • Schedules are filtered to a 2-month window using useMemo with proper date boundaries
  • Navigation is handled through a scrollable tab interface with intersection observer for current week visibility
  • The filteredSchedules.at(value) safely returns undefined for out-of-bounds indices, with null fallback
  • UI updates automatically as schedules transition in/out of the filter window
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for schedule navigation edge cases
# Look for any comments or issues related to schedule navigation
rg -A 3 "schedule.*navigation|schedule.*scroll|schedule.*boundary" 

# Check for existing implementations of historical data access
ast-grep --pattern 'historical.*schedule|archive.*schedule|old.*schedule'

Length of output: 981


Script:

#!/bin/bash
# Check the implementation of filteredSchedules and related navigation logic
ast-grep --pattern 'const filteredSchedules = $_'

# Look for any date filtering or window logic
rg -B 2 -A 4 "filter.*schedule|window.*schedule|month.*schedule"

# Check for any error handling or boundary conditions
ast-grep --pattern 'if ($schedules.length === 0) {
  $$$
}'

Length of output: 14595


Script:

#!/bin/bash
# Check the implementation of navigation and tab handling
rg -B 3 -A 5 "handleWeekChange|setCurrentTab|onChange"

# Look for any boundary checks or error states in the week selector
ast-grep --pattern 'const handleWeekChange = ($value) => {
  $$$
}'

Length of output: 66121


Script:

#!/bin/bash
# Check the week selector component implementation
rg -B 5 -A 5 "schedules-view-week-selector"

# Look for any error handling or boundary checks in the week selector
ast-grep --pattern 'const WeekSelector = ($_) => {
  $$$
}'

Length of output: 4839

src/features/meetings/weekly_schedules/weekend_meeting/useWeekendMeeting.tsx (1)

62-62: Verify consistent behavior between meeting types.

The filtering implementation should behave identically for both meeting types. Let's verify this consistency:

Also applies to: 203-205

✅ Verification successful

Filtering behavior is identical between meeting types

Based on the search results, both useWeekendMeeting.tsx and useMidweekMeeting.tsx implement identical filtering logic:

  • Both use the same filteredSchedules implementation that filters records from the last 2 months
  • Both use identical .at(value)?.weekOf || null pattern for schedule selection
  • Both have the same schedule lookup and index finding mechanisms
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Compare the implementation details between meeting types
echo "Checking for differences in schedule handling between meeting types..."
rg -A 5 "filteredSchedules" "src/features/meetings/weekly_schedules/"

# Look for any schedule-related issues or comments
rg "schedule.*issue|schedule.*bug" "src/features/meetings/"

Length of output: 4307

src/features/app_start/vip/startup/useStartup.tsx (1)

35-40: LGTM: Authentication enhancement

Good addition of Firebase authentication state management.

src/views/meetings/midweek/S140/app_normal/index.tsx (1)

109-112: Verify S140Hall component accepts counselor prop

Ensure that the S140Hall component is updated to handle the new counselor prop.

✅ Verification successful

S140Hall component correctly accepts the counselor prop

The component is properly set up to handle the counselor prop:

  • Type definition in index.types.ts includes counselor?: string
  • Component implementation in S140Hall.tsx destructures and uses the counselor prop
  • Renders counselor text conditionally when the prop is provided
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if S140Hall component accepts counselor prop

# Search for S140Hall component definition
ast-grep --pattern 'const S140Hall = ({ $props }) => {
  $$$
}'

# Search for counselor prop usage in S140Hall
rg -A 5 'counselor.*prop|prop.*counselor' --type tsx

Length of output: 148


Script:

#!/bin/bash
# Let's try different approaches to find the S140Hall component definition

# Search for S140Hall component using more flexible patterns
ast-grep --pattern 'S140Hall = $_'

# Search for files containing S140Hall
fd S140Hall

# Search for S140Hall in all files (without file type restriction)
rg -A 5 'S140Hall.*=|type.*S140Hall|interface.*S140Hall'

Length of output: 1586

src/services/dexie/schema.ts (1)

313-313: Verify the impact of increasing the backup interval

The automatic backup interval has been increased from 5 to 15. While this reduces system load, please verify:

  1. Data protection requirements are still met with less frequent backups
  2. Risk assessment for potential data loss in case of system failure
✅ Verification successful

Let me search for more specific information about the automatic backup implementation and its requirements.


Based on the code analysis, I can now provide a final response:

Increasing backup interval to 15 minutes is acceptable

The change to increase the backup interval from 5 to 15 minutes is reasonable because:

  1. The backup system is primarily for data synchronization rather than critical disaster recovery, as evidenced by its implementation in useWebWorker.tsx
  2. The interval is still frequent enough (every 15 minutes) to prevent significant data loss
  3. The backup feature is configurable by users through app settings, indicating it's not a critical system requirement
  4. There are no documented requirements for specific backup frequencies in the codebase
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any data protection or backup requirements in documentation

# Check README and docs for backup requirements
echo "Checking documentation for backup requirements..."
rg -i "backup|data protection|recovery" README.md || true
fd -e md -e txt . -x rg -i "backup|data protection|recovery" {} || true

Length of output: 3876


Script:

#!/bin/bash
# Search for automatic backup implementation details
echo "Checking for automatic backup implementation..."
rg -i "automatic.?backup" -A 5 -B 5

# Search for backup interval related code
echo -e "\nChecking for backup interval usage..."
rg -i "backup.?interval" -A 5 -B 5

Length of output: 19734

src/services/app/persons.ts (1)

68-69: LGTM: Improved error handling with early returns

Good defensive programming practice! The added early returns prevent potential null pointer issues when no current record is found.

Also applies to: 104-105, 139-140

src/services/app/schedules.ts (1)

2189-2189: Fixed incorrect field names for auxiliary class assignments

Good catch! The field names for auxiliary class students and assistants were incorrectly using suffix '_A' instead of '_B'. This fix ensures correct assignment tracking.

Also applies to: 2191-2191

✅ Verification successful

Let me gather more context about the specific changes in schedules.ts to understand if this is an isolated fix or part of a pattern.


Fixed incorrect field names for auxiliary class assignments

The changes are correct and consistent with the codebase. The evidence shows:

  1. Both A and B suffixes are used systematically throughout the codebase for student and assistant assignments (MM_AYFPart[1-4])
  2. The field naming pattern is consistently used in UI components and schedule management code
  3. No remaining incorrect patterns were found that mix aux_class with wrong suffixes
  4. The changes align with the existing assignment structure in schedules.ts where both A and B variants are properly handled
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of the field name changes

# Check for any remaining incorrect field patterns in the codebase
echo "Checking for any remaining incorrect field patterns..."
rg "MM_AYFPart\d+_(Student|Assistant)_A.*aux_class" || true

# Check for any UI components that might be affected
echo "Checking UI components that might be affected..."
fd -e tsx -e jsx . -x rg "MM_AYFPart.*_(Student|Assistant)_(A|B)" {} || true

Length of output: 1852


Script:

#!/bin/bash
# Check the surrounding context of the changes in schedules.ts
echo "Checking context of the field assignments in schedules.ts..."
rg -B 5 -A 5 "MM_AYFPart\d+_(Student|Assistant)_(A|B)" src/services/app/schedules.ts

# Look for any test files that might need updates
echo "Checking test files for these field patterns..."
fd -e test.ts -e spec.ts . -x rg "MM_AYFPart.*_(Student|Assistant)_(A|B)" {} || true

Length of output: 3312

@rhahao rhahao merged commit 114ed37 into sws2apps:main Dec 3, 2024
14 checks passed
Copy link

cypress bot commented Dec 3, 2024

organized-app    Run #1739

Run Properties:  status check passed Passed #1739  •  git commit 114ed374ac: fix(schedules): include current week in active assignments
Project organized-app
Branch Review main
Run status status check passed Passed #1739
Run duration 00m 19s
Commit git commit 114ed374ac: fix(schedules): include current week in active assignments
Committer rhahao
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 1
View all changes introduced in this branch ↗︎

@rhahao
Copy link
Member Author

rhahao commented Dec 3, 2024

🎉 This PR is included in version 3.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FIX] Infinite loading & animation is not vertically centered
1 participant