diff --git a/script/queries/nfp_audit_report_non_congress.rb b/script/queries/nfp_audit_report_non_congress.rb index 5b974adc4..98724b8f4 100644 --- a/script/queries/nfp_audit_report_non_congress.rb +++ b/script/queries/nfp_audit_report_non_congress.rb @@ -26,9 +26,11 @@ emp_ids = Employer.where(:fein => {"$nin" => congress_feins }).map(&:id) +start_year = Date.today.year - 3 pols = Policy.where({ :enrollees => {"$elemMatch" => { - :rel_code => "self" + :rel_code => "self", + :coverage_start => {"$gt" => Date.new(start_year, 12, 31)}, }}, :employer_id => { "$in" => emp_ids } }) Caches::MongoidCache.allocate(Plan)