View Source Squeeze.ActivityMatcher (OpenPace v0.0.1)
This module matches new activities to existing activities.
Link to this section Summary
Functions
Gets the closest activity for a user given an activity.
Link to this section Functions
Gets the closest activity for a user given an activity.
Matches on the following criteria:
- Only matches if the activities are on the same date
- Only matches if activities are of the same type (example: "Run" or "Ride")
- If multiple activities match, it scores the activities based on distance, duration, and external_id
Returns nil if no activities match
examples
Examples
iex> get_closest_activity(user, matching_activity) %Activity{}
iex> get_closest_activity(user, no_match_activity) null