Fix recurring event RRULE INTERVAL and COUNT parameter loss

This commit fixes a critical bug where INTERVAL and COUNT parameters
were being stripped from recurring events during backend processing.

Frontend was correctly generating complete RRULE strings like:
FREQ=WEEKLY;INTERVAL=2;BYDAY=TU,FR;COUNT=6

But backend was ignoring the complete RRULE and rebuilding from scratch,
resulting in simplified RRULEs like:
FREQ=WEEKLY;BYDAY=TU,FR (missing INTERVAL and COUNT)

Changes:
- Modified both events and series handlers to detect complete RRULE strings
- Added logic to use frontend RRULE directly when it starts with "FREQ="
- Maintained backwards compatibility with simple recurrence types
- Added comprehensive debug logging for RRULE generation
- Fixed weekly BYDAY occurrence counting to respect COUNT parameter
- Enhanced frontend RRULE generation with detailed logging

This ensures all RFC 5545 RRULE parameters are preserved from
frontend creation through CalDAV storage and retrieval.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Connor Johnstone
2025-08-31 00:28:41 -04:00
parent d0aa6fda08
commit c599598390
4 changed files with 509 additions and 58 deletions

View File

@@ -161,8 +161,16 @@ pub async fn create_event_series(
// Set priority
event.priority = request.priority;
// Generate the RRULE for recurrence
let rrule = build_series_rrule_with_freq(&request, recurrence_freq)?;
// Check if recurrence is already a full RRULE or just a simple type
let rrule = if request.recurrence.starts_with("FREQ=") {
// Frontend sent a complete RRULE string, use it directly
println!("🎯 SERIES: Using complete RRULE from frontend: {}", request.recurrence);
request.recurrence.clone()
} else {
// Legacy path: Generate the RRULE for recurrence
println!("🔄 SERIES: Building RRULE from simple recurrence type: {}", request.recurrence);
build_series_rrule_with_freq(&request, recurrence_freq)?
};
event.rrule = Some(rrule);
println!("🔁 Generated RRULE: {:?}", event.rrule);