Skip to content

Instantly share code, notes, and snippets.

@babgyy
Last active May 27, 2025 11:53
Show Gist options
  • Save babgyy/bdef0d27b38aca5b0ee59b06c696c8e7 to your computer and use it in GitHub Desktop.
Save babgyy/bdef0d27b38aca5b0ee59b06c696c8e7 to your computer and use it in GitHub Desktop.
Stats Reco TIME
range = 6.months.ago..Time.zone.now
cs = ConsultationSpecialty.find_by_slug("erectile_dysfunction")
with_reco = Consultation.
includes(:spree_order).where(spree_orders: { first_of_type: true }).
where(consultation_specialty: cs, recommended_master: true, first_finished_at: range).finished.count
total = Consultation.
includes(:spree_order).where(spree_orders: { first_of_type: true }).
where(consultation_specialty: cs, first_finished_at: range).finished.count
puts "MASTER"
puts "#{total} consultations, dont #{with_reco} avec Reco"
cs = ConsultationSpecialty.find_by_slug("premature_ejaculation")
with_reco = Consultation.
includes(:spree_order).where(spree_orders: { first_of_type: true }).
where(consultation_specialty: cs, recommended_time: true, first_finished_at: range).finished.count
total = Consultation.
includes(:spree_order).where(spree_orders: { first_of_type: true }).
where(consultation_specialty: cs, first_finished_at: range).finished.count
puts "TIME"
puts "#{total} consultations, dont #{with_reco} avec Reco"
# --- CHECKJ
range = 6.months.ago..Time.zone.now
with_reco = Consultation.
where(recommended_master: true, first_finished_at: range).finished.count
total = Consultation.
where(first_finished_at: range).finished.count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment