mirror of
https://github.com/Magnus167/rustframe.git
synced 2025-08-20 04:00:01 +00:00
removing unused comments and cleaning up the code structure
This commit is contained in:
parent
629c9d84e2
commit
c37659f09d
@ -1,7 +1,9 @@
|
||||
//! This module provides functionality for generating and manipulating business dates.
|
||||
//! It includes the `BDatesList`, which emulates a `DateList` structure and its properties.
|
||||
//! It uses `DateList` and `DateListGenerator`, adjusting the output to work on business dates.
|
||||
|
||||
use chrono::{Datelike, Duration, NaiveDate, Weekday};
|
||||
use std::collections::HashMap;
|
||||
use std::error::Error;
|
||||
use std::hash::Hash;
|
||||
use std::result::Result;
|
||||
|
||||
use crate::utils::dateutils::dates::{find_next_date, AggregationType, DateFreq, DatesGenerator};
|
||||
@ -16,19 +18,6 @@ pub struct BDatesList {
|
||||
start_date_str: String,
|
||||
end_date_str: String,
|
||||
freq: DateFreq,
|
||||
// TODO: cache the generated date list to reduce repeated computation.
|
||||
// Currently, list(), count(), and groups() regenerate the list on every invocation.
|
||||
// cached_list: Option<Vec<NaiveDate>>,
|
||||
}
|
||||
|
||||
// Enumeration of period keys used for grouping dates.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
enum GroupKey {
|
||||
Daily(NaiveDate), // Daily grouping: use the exact date
|
||||
Weekly(i32, u32), // Weekly grouping: use year and ISO week number
|
||||
Monthly(i32, u32), // Monthly grouping: use year and month (1-12)
|
||||
Quarterly(i32, u32), // Quarterly grouping: use year and quarter (1-4)
|
||||
Yearly(i32), // Yearly grouping: use year
|
||||
}
|
||||
|
||||
/// Represents a collection of business dates generated according to specific rules.
|
||||
@ -404,7 +393,6 @@ impl Iterator for BDatesGenerator {
|
||||
|
||||
DateFreq::WeeklyMonday | DateFreq::WeeklyFriday => next_date,
|
||||
DateFreq::MonthEnd | DateFreq::QuarterEnd | DateFreq::YearEnd => {
|
||||
// Adjust to the last business date of the month, quarter, or year.
|
||||
let adjusted_date = iter_reverse_till_bdate(next_date);
|
||||
if self.start_date > adjusted_date {
|
||||
// Skip this iteration if the adjusted date is before the start date.
|
||||
@ -1192,4 +1180,4 @@ mod tests {
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
} // end mod tests
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user