Various visit creation improvements#2284
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can use OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.OpenGrep is compatible with Semgrep configurations. Add an |
Resolve visit creator conflict by keeping all-status deduplication with visit.center fallback and interval-overlap matching. Made-with: Cursor
|
Thanks for the contribution! |
Some improvements to the visit suggestion job based on behavior I see in my dawarich deployment.
app/models/visit.rbintoapp/services/visits/suggest.rb, allowing us to deduplicate.app/services/visits/creator.rb: For visits, check for any existing visit (confirmed, suggested, or declined). This prevents duplicating suggested visits, especially in cases where new points are imported after the nightly visit suggestion job runs.confirmedvisits? IMO the distinction is not needed, and the logic works well on all visits.app/services/visits/creator.rb:visits.mapcontinues withnilif the visit is pre-existing. This prevents runningcreate_visits_notificationif all visits are pre-existing.app/services/visits/creator.rb: Simplify the time check for existing visits.app/services/visits/creator.rb: Usevisit.centerwhich supports calculating the center of visit from area, place, and falls back to points.