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

fix: Allow identical ticks on one day #340

Merged
merged 1 commit into from
Jul 13, 2023

Conversation

musoke
Copy link
Contributor

@musoke musoke commented Jul 13, 2023

The schema enforces a unique index on {climbId, dateClimbed, style, userID, source}. This is meant to prevent duplicating ticks imported from mountain project. However, it also prevents logging such ticks when they are legitimate.

The import procedure also deletes imported ticks before reimporting, so this was overly cautious.

Change the schema so it does not enforce uniqueness in this way. Instead, add non-unique indexes on { userId } and { userId, climbId }.

Add a db migration script.

Remove climb uniqueness test.

Fixes OpenBeta/open-tacos#631

The schema enforces a unique index on {climbId, dateClimbed, style,
userID, source}.  This is meant to prevent duplicating ticks imported
from mountain project.  However, it also prevents logging such ticks
when they are legitimate.

The import procedure also deletes imported ticks before reimporting, so
this was overly cautious.

Change the schema so it does not enforce uniqueness in this way.
Instead, add non-unique indexes on { userId } and { userId, climbId }.

Add a db migration script.

Remove climb uniqueness test.

Fixes OpenBeta/open-tacos#631
@musoke musoke requested a review from vnugent July 13, 2023 23:17
@musoke
Copy link
Contributor Author

musoke commented Jul 13, 2023

I tried a couple known-problematic logbooks and each worked as expected.

@vnugent vnugent merged commit 8bf4c4f into OpenBeta:develop Jul 13, 2023
1 check passed
@vnugent
Copy link
Contributor

vnugent commented Jul 13, 2023

Deployed to staging and production

@musoke musoke deleted the fix-unique-climb-#631 branch July 13, 2023 23:48
@musoke
Copy link
Contributor Author

musoke commented Jul 13, 2023

Did you run the migration? I haven't written one before so if you haven't done it yet, double check the script before you use it!

@vnugent
Copy link
Contributor

vnugent commented Jul 14, 2023

Did you run the migration? I haven't written one before so if you haven't done it yet, double check the script before you use it!

Done. Can you try importing again?

@musoke
Copy link
Contributor Author

musoke commented Jul 14, 2023

It works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

MP import feature only shows 3
2 participants