Fix when Moving Event, Note/Event Becomes Duplicated#1055
Fix when Moving Event, Note/Event Becomes Duplicated#1055yujonglee merged 2 commits intofastrepl:mainfrom
Conversation
📝 WalkthroughWalkthroughA new asynchronous method for updating events was added to the user database implementation. The Apple Calendar synchronization logic was enhanced to detect and process rescheduled events by updating existing database records when matching events are found with changed tracking IDs. Supporting structures and methods were updated to facilitate this flow. Changes
Sequence Diagram(s)sequenceDiagram
participant SystemCalendar
participant SyncLogic
participant UserDatabase
SystemCalendar->>SyncLogic: Provide all events
SyncLogic->>UserDatabase: Fetch all DB events
loop For each DB event
SyncLogic->>SystemCalendar: Check for event with matching tracking_id
alt Match found
SyncLogic->>UserDatabase: Schedule update with latest event details
else No exact match
SyncLogic->>SystemCalendar: Search for rescheduled event (name match, start date within 30 days, different tracking_id)
alt Rescheduled event found
SyncLogic->>UserDatabase: Schedule update with new tracking_id and details
else Not found
SyncLogic->>UserDatabase: Mark event for deletion
end
end
end
SyncLogic->>UserDatabase: Insert new events (skip already updated/handled)
SyncLogic->>UserDatabase: Execute updates via update_event for each to_update
Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes detected. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Clippy (1.86.0)error: failed to load source for dependency Caused by: Caused by: Caused by: 📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (3)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
crates/db-user/src/events_ops.rs(1 hunks)plugins/apple-calendar/src/sync.rs(4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{js,ts,tsx,rs}`: 1. No error handling. 2. No unused imports, variables, or functions. 3. For comments, keep it minimal. It should be about "Why", not "What".
**/*.{js,ts,tsx,rs}: 1. No error handling.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".
⚙️ Source: CodeRabbit Configuration File
List of files the instruction was applied to:
crates/db-user/src/events_ops.rsplugins/apple-calendar/src/sync.rs
🧬 Code Graph Analysis (1)
crates/db-user/src/events_ops.rs (4)
plugins/db/js/bindings.gen.ts (1)
Event(156-156)crates/db-core/src/lib.rs (1)
conn(17-22)crates/db-user/src/sessions_types.rs (1)
from_row(26-63)crates/db-user/src/extensions_types.rs (1)
from_row(43-57)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: ci (windows, windows-latest)
- GitHub Check: ci (macos, macos-latest)
- GitHub Check: ci
🔇 Additional comments (3)
plugins/apple-calendar/src/sync.rs (3)
116-122: LGTM!Efficient collection of system events using references to avoid unnecessary cloning.
139-183: Well-implemented event update logic.The code correctly handles both exact tracking ID matches and potential reschedules, while preserving important fields like the database ID and google_event_url. This ensures user data (sessions/notes) remains associated with the event.
201-233: Correct deduplication logic and consistent error handling.The code properly avoids duplicating events that have been handled as updates or already exist in the database. The error handling follows the existing pattern of logging errors without propagation.
Also applies to: 412-417
fixes #961