Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude overlapping rides #95

Merged
merged 2 commits into from
Feb 10, 2025
Merged

Exclude overlapping rides #95

merged 2 commits into from
Feb 10, 2025

Conversation

merlinorg
Copy link
Contributor

@merlinorg merlinorg commented Feb 9, 2025

Duplicate rides, where riders are riding with multiple devices and forgetting to delete some Strava activities, currently tip the balance of victory. This will exclude such overlapping rides.

Resolves #34

This has been tested successfully.

# part of the ride and one will be excluded. Just upload three rides instead.
# Allow some overlap at the start end, just in case .. things.
# Use local time because that's what is stored in the database.
def check_db_overlap(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This occurs when a single new strava activity comes in the MQ.

# If this rider has overlapping rides, just select the largest ride. This is because when
# we run a full sync the database may be empty so we pull all rides from Strava then filter
# and then insert, so filtering can't look at the database.
def overlaps_larger(activity, activities):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This occurs when we do a full rider sync, so we've pulled all activities and will then insert them in bulk.

@merlinorg merlinorg force-pushed the no-overlapping-rides branch from 7ec6fbb to 9e11351 Compare February 9, 2025 18:45
Copy link
Member

@obscurerichard obscurerichard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻 :shipit:

@merlinorg merlinorg force-pushed the no-overlapping-rides branch from 9e11351 to 86dfdb3 Compare February 10, 2025 21:12
@merlinorg merlinorg merged commit b15ae47 into main Feb 10, 2025
6 checks passed
@merlinorg merlinorg deleted the no-overlapping-rides branch February 10, 2025 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Eliminate duplicate rides
2 participants