-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
MP import feature only shows 3 #631
Comments
I think I understand what happened: the importer couldn't handle the same route appearing twice in a row. The same happened to my attempted import. The first 32 routes were fine, but the rest are missing. The 33rd tick in my logbook is of the same route as the 32nd. Judging by the dates on this issue and their logbook, these were the three most recent routes at the time of the attempted import:
These are the three ticks imported successfully:
It seems to have failed when it saw the second Hardman. |
I think due to date string being used as the unique constraint: OpenBeta/openbeta-graphql#175 |
Ah! Makes sense. Not sure I have the skills to fix it.
…On Tue, Apr 18, 2023, 10:18 Viet Nguyen ***@***.***> wrote:
Is there a reason for that being disallowed? I often do a climb more than
once in a day.
I think due to date string being used as the unique constraint:
OpenBeta/openbeta-graphql#175
<OpenBeta/openbeta-graphql#175>
—
Reply to this email directly, view it on GitHub
<#631 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD7ET7BGL7OVPFGBUJ5EJITXB2PDVANCNFSM6AAAAAATHED22A>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
In any case, the importer should probably attempt to continue after encountering an error with individual ticks. |
I want to work at this issue but i need API keys to access users Profile. |
@milbmr |
I have another datapoint: I imported the following log book:
Here's the list of ticks as reported by https://stg-api.openbeta.io:
The first pair imports successfully, the second does not. |
I get this error when doing the import on a local dev open-tacos instance with the prod backend.
|
I see what's going on now. The database has a unique constraint on climb, date, style, user, source to prevent the same tick from being imported multiple times. We can think of some other way to address re-import use case. TickSchema.index({ climbId: 1, dateClimbed: 1, style: 1, userId: 1, source: 1 }, { unique: true }) https://github.com/OpenBeta/openbeta-graphql/blob/develop/src/db/TickSchema.ts#L27 |
I think the current implementation deletes previously imported ticks before doing the new import, so one can probably disable this addition check for now? Double check this. |
You're right. The import deletes all previous ones. We can change the indexes to something like this: TickSchema.index({ userId: 1 }) // ticksByUser()
TickSchema.index({ climbId: 1, userId: 1 }) // for ticksByUserIdAndClimb() |
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
Expected Behavior
MP user: https://www.mountainproject.com/user/200492669/andre-chiquito
OB profile: https://openbeta.io/u/all_terrain_human
The user has over 400 ticks but it seems only 3 are imported/shown
cc @Downster
The text was updated successfully, but these errors were encountered: