From 8c3d190512b8a7a0dfc49bc606cb2574d8ec319b Mon Sep 17 00:00:00 2001 From: Fredrik Meringdal Date: Thu, 15 Oct 2020 23:59:16 +0200 Subject: many tests passing --- src/iter.rs | 3 +++ src/monthinfo.rs | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/iter.rs b/src/iter.rs index 401207e..d6f78b5 100644 --- a/src/iter.rs +++ b/src/iter.rs @@ -115,10 +115,12 @@ pub fn iter(iter_result: &mut IterResult, options: &mut ParsedOptions) -> Vec>>(); + println!("dayset: {:?}", dayset); let filtered = remove_filtered_days(&mut dayset, start, end, &ii, options); @@ -156,6 +158,7 @@ pub fn iter(iter_result: &mut IterResult, options: &mut ParsedOptions) -> Vec = vec![]; if options.freq == Frequenzy::YEARLY { if options.bymonth.is_empty() { - ranges = vec![(0, year as isize)]; + ranges = vec![(0, yearlen as isize)]; } else { for j in 0..options.bymonth.len() { let m = options.bymonth[j]; @@ -49,6 +49,9 @@ pub fn rebuild_month( // care about cross-year weekly periods. result.nwdaymask = vec![0; yearlen]; + println!("{:?}", options.bynweekday); + println!("{:?}", ranges); + for j in 0..ranges.len() { let rang = ranges[j]; let first = rang.0; @@ -60,9 +63,12 @@ pub fn rebuild_month( let n = options.bynweekday[k][1]; if n < 0 { i = last + (n + 1) * 7; + println!("n: {}, last: {}", n, last); + println!("i 1 is {}", i); i -= pymod(wdaymask[i as usize] as isize - wday, 7); } else { i = first + (n - 1) * 7; + println!("i 2 is {}", i); i += pymod(7 - wdaymask[i as usize] as isize + wday, 7); } if first <= i && i <= last { -- cgit v1.2.3