diff options
author | Fredrik Meringdal <fmeringdal@hotmail.com> | 2020-10-16 01:31:17 +0200 |
---|---|---|
committer | Fredrik Meringdal <fmeringdal@hotmail.com> | 2020-10-16 01:31:17 +0200 |
commit | 9e5742a46211fbf4cb33e32082febb5932b5ad3e (patch) | |
tree | 02a73c9e7a52a251371659eaee08ca63c0a4d3cb /src | |
parent | 81a3af0630bf43931862f117b8e30d1989a7aa45 (diff) | |
download | rust_rrule-9e5742a46211fbf4cb33e32082febb5932b5ad3e.zip |
more tests and some bug fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/iter.rs | 13 | ||||
-rw-r--r-- | src/yearinfo.rs | 4 |
2 files changed, 6 insertions, 11 deletions
diff --git a/src/iter.rs b/src/iter.rs index b9c1560..daa67c2 100644 --- a/src/iter.rs +++ b/src/iter.rs @@ -108,7 +108,6 @@ pub fn iter(iter_result: &mut IterResult, options: &mut ParsedOptions) -> Vec<Da }; loop { - println!("Main loop"); let (dayset, start, end) = ii.getdayset( &options.freq, counter_date.year() as isize, @@ -120,10 +119,8 @@ pub fn iter(iter_result: &mut IterResult, options: &mut ParsedOptions) -> Vec<Da .into_iter() .map(|s| Some(s as isize)) .collect::<Vec<Option<isize>>>(); - println!("dayset: {:?}", dayset); let filtered = remove_filtered_days(&mut dayset, start, end, &ii, options); - println!("dayset: {:?}", dayset); if not_empty(&options.bysetpos) { let poslist = build_poslist(&options.bysetpos, ×et, start, end, &ii, &dayset); @@ -150,7 +147,6 @@ pub fn iter(iter_result: &mut IterResult, options: &mut ParsedOptions) -> Vec<Da } } } else { - println!("start: {}, end: {}", start, end); for j in start..end { let current_day = dayset[j]; if current_day.is_none() { @@ -159,7 +155,6 @@ pub fn iter(iter_result: &mut IterResult, options: &mut ParsedOptions) -> Vec<Da let current_day = current_day.unwrap(); let date = from_ordinal(ii.yearordinal().unwrap() + current_day); - println!("timeset: {}", timeset.len()); for k in 0..timeset.len() { let res = Utc.ymd(date.year(), date.month(), date.day()).and_hms( timeset[k].hour as u32, @@ -270,10 +265,10 @@ pub fn not_empty<T>(v: &Vec<T>) -> bool { } pub fn is_filtered(ii: &IterInfo, current_day: usize, options: &ParsedOptions) -> bool { - println!( - "Was filtered here: {}", - (not_empty(&options.byweekno) && (ii.wnomask().unwrap()[current_day]) == 0) - ); + //println!( + //"Filtered here: {}", + //(not_empty(&options.byweekno) && (ii.wnomask().unwrap()[current_day]) == 0) + //); return (not_empty(&options.bymonth) && !includes(&options.bymonth, &ii.mmask().unwrap()[current_day])) || (not_empty(&options.byweekno) && (ii.wnomask().unwrap()[current_day]) == 0) diff --git a/src/yearinfo.rs b/src/yearinfo.rs index a2cd972..5ae6340 100644 --- a/src/yearinfo.rs +++ b/src/yearinfo.rs @@ -115,7 +115,7 @@ pub fn rebuild_year(year: i32, options: &ParsedOptions) -> YearInfo { } let div = (wyearlen as f32 / 7.).round() as isize; - let year_mod = pymod(div, 7); + let year_mod = pymod(wyearlen, 7); //const numweeks = Math.floor(div + mod / 4) let numweeks = div + (year_mod / 4); @@ -174,7 +174,7 @@ pub fn rebuild_year(year: i32, options: &ParsedOptions) -> YearInfo { // days from last year's last week number in // this year. let lnumweeks; - if options.byweekno.iter().any(|&weekno| weekno == -1) { + if !options.byweekno.iter().any(|&weekno| weekno == -1) { let lyearweekday = get_weekday_val(&Utc.ymd(year - 1, 1, 1).weekday()); let lno1wkst = pymod((7 - lyearweekday + options.wkst) as isize, 7); |