Fix recurring event count bug: events with COUNT=5 now stop after 5 occurrences
All checks were successful
Build and Push Docker Image / docker (push) Successful in 1m19s
All checks were successful
Build and Push Docker Image / docker (push) Successful in 1m19s
Events created with specific occurrence counts (like "repeat 5 times") were repeating forever instead of stopping after the specified number. Root cause: Frontend form collected recurrence_count and recurrence_until values correctly, but these weren't being passed through the event creation pipeline to the backend, which was hardcoding None values. Fix implemented across entire creation flow: 1. **Enhanced Parameter Conversion**: - Added recurrence_count and recurrence_until to to_create_event_params() tuple - Properly extracts values from form: recurrence_count, recurrence_until.map() 2. **Updated Backend Method Signature**: - Added recurrence_count: Option<u32> and recurrence_until: Option<String> - to create_event() method parameters 3. **Fixed Backend Implementation**: - Replace hardcoded None values with actual form parameters - "recurrence_end_date": recurrence_until, "recurrence_count": recurrence_count 4. **Updated Call Sites**: - Modified app.rs to pass params.18 (recurrence_count) and params.19 (recurrence_until) - Proper parameter indexing after tuple expansion Result: Complete recurrence control now works correctly: - ✅ Events with COUNT=5 stop after exactly 5 occurrences - ✅ Events with UNTIL date stop on specified date - ✅ Events with "repeat forever" continue indefinitely - ✅ Proper iCalendar RRULE generation with COUNT/UNTIL parameters 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -595,6 +595,8 @@ pub fn App() -> Html {
|
|||||||
params.14, // reminder
|
params.14, // reminder
|
||||||
params.15, // recurrence
|
params.15, // recurrence
|
||||||
params.16, // recurrence_days
|
params.16, // recurrence_days
|
||||||
|
params.18, // recurrence_count
|
||||||
|
params.19, // recurrence_until
|
||||||
params.17, // calendar_path
|
params.17, // calendar_path
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|||||||
@@ -149,6 +149,8 @@ impl EventCreationData {
|
|||||||
String, // recurrence
|
String, // recurrence
|
||||||
Vec<bool>, // recurrence_days
|
Vec<bool>, // recurrence_days
|
||||||
Option<String>, // calendar_path
|
Option<String>, // calendar_path
|
||||||
|
Option<u32>, // recurrence_count
|
||||||
|
Option<String>, // recurrence_until
|
||||||
) {
|
) {
|
||||||
(
|
(
|
||||||
self.title.clone(),
|
self.title.clone(),
|
||||||
@@ -169,6 +171,8 @@ impl EventCreationData {
|
|||||||
format!("{:?}", self.recurrence),
|
format!("{:?}", self.recurrence),
|
||||||
self.recurrence_days.clone(),
|
self.recurrence_days.clone(),
|
||||||
self.selected_calendar.clone(),
|
self.selected_calendar.clone(),
|
||||||
|
self.recurrence_count,
|
||||||
|
self.recurrence_until.map(|d| d.format("%Y-%m-%d").to_string()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1249,6 +1249,8 @@ impl CalendarService {
|
|||||||
reminder: String,
|
reminder: String,
|
||||||
recurrence: String,
|
recurrence: String,
|
||||||
recurrence_days: Vec<bool>,
|
recurrence_days: Vec<bool>,
|
||||||
|
recurrence_count: Option<u32>,
|
||||||
|
recurrence_until: Option<String>,
|
||||||
calendar_path: Option<String>,
|
calendar_path: Option<String>,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
let window = web_sys::window().ok_or("No global window exists")?;
|
let window = web_sys::window().ok_or("No global window exists")?;
|
||||||
@@ -1281,8 +1283,8 @@ impl CalendarService {
|
|||||||
"recurrence": recurrence,
|
"recurrence": recurrence,
|
||||||
"recurrence_days": recurrence_days,
|
"recurrence_days": recurrence_days,
|
||||||
"recurrence_interval": 1_u32, // Default interval
|
"recurrence_interval": 1_u32, // Default interval
|
||||||
"recurrence_end_date": None as Option<String>, // No end date by default
|
"recurrence_end_date": recurrence_until,
|
||||||
"recurrence_count": None as Option<u32>, // No count limit by default
|
"recurrence_count": recurrence_count,
|
||||||
"calendar_path": calendar_path
|
"calendar_path": calendar_path
|
||||||
});
|
});
|
||||||
let url = format!("{}/calendar/events/series/create", self.base_url);
|
let url = format!("{}/calendar/events/series/create", self.base_url);
|
||||||
|
|||||||
Reference in New Issue
Block a user