Clean up unused code and compiler warnings
Removed unused functions and variables identified after RRULE parameter fix: - Remove unused build_series_rrule function from backend series handler - Remove unused RecurrenceType::from_rrule and helper functions from frontend - Prefix unused state variables with underscores to suppress warnings 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -866,34 +866,6 @@ impl CalendarService {
|
||||
}
|
||||
|
||||
|
||||
/// Calculate next weekday occurrence for WEEKLY frequency with BYDAY
|
||||
fn next_weekday_occurrence(current_date: NaiveDate, byday: &str, interval: i32) -> NaiveDate {
|
||||
let weekdays = Self::parse_byday(byday);
|
||||
if weekdays.is_empty() {
|
||||
return current_date + Duration::weeks(interval as i64);
|
||||
}
|
||||
|
||||
let current_weekday = current_date.weekday();
|
||||
|
||||
// Find next occurrence within current week
|
||||
let mut next_occurrences = Vec::new();
|
||||
for &target_weekday in &weekdays {
|
||||
let days_until = Self::days_until_weekday(current_weekday, target_weekday);
|
||||
if days_until > 0 {
|
||||
next_occurrences.push((days_until, target_weekday));
|
||||
}
|
||||
}
|
||||
|
||||
// Sort by days_until and return the closest one
|
||||
if !next_occurrences.is_empty() {
|
||||
next_occurrences.sort_by_key(|(days, _)| *days);
|
||||
return current_date + Duration::days(next_occurrences[0].0 as i64);
|
||||
}
|
||||
|
||||
// No more occurrences this week, move to next interval
|
||||
let next_week_start = current_date + Duration::weeks(interval as i64) - Duration::days(current_weekday.num_days_from_monday() as i64);
|
||||
next_week_start + Duration::days(weekdays[0].num_days_from_monday() as i64)
|
||||
}
|
||||
|
||||
/// Parse BYDAY parameter (e.g., "MO,WE,FR" -> [Monday, Wednesday, Friday])
|
||||
fn parse_byday(byday: &str) -> Vec<Weekday> {
|
||||
@@ -912,19 +884,6 @@ impl CalendarService {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Calculate days until target weekday
|
||||
fn days_until_weekday(from: Weekday, to: Weekday) -> i32 {
|
||||
let from_num = from.num_days_from_monday();
|
||||
let to_num = to.num_days_from_monday();
|
||||
|
||||
if to_num > from_num {
|
||||
(to_num - from_num) as i32
|
||||
} else if to_num < from_num {
|
||||
(7 + to_num - from_num) as i32
|
||||
} else {
|
||||
0 // Same day
|
||||
}
|
||||
}
|
||||
|
||||
/// Add months to a date (handling month boundary issues)
|
||||
fn add_months(date: NaiveDate, months: i32) -> Option<NaiveDate> {
|
||||
|
||||
Reference in New Issue
Block a user