-
-
Notifications
You must be signed in to change notification settings - Fork 239
Fixed card duplication issue #2349 #2759
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
Open
matuspetro
wants to merge
7
commits into
CatimaLoyalty:main
Choose a base branch
from
matuspetro:card-duplication-issue-#2349
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a95f5ce
Fixed img comparison
matuspetro 4bf0862
Fixed issue: duplicity after importing same zip again
matuspetro 61e0ca4
fix rewriting imgs
matuspetro f2b2f3c
replace imageChecksums with bitmapComparing
matuspetro a832066
fixed test errors
matuspetro 3dece0b
update useless if and some code style
matuspetro 50c29f5
change getLoyaltyCardsByCardId to getLoyaltyCardCursor
matuspetro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if you confused this with the unique ID before (this is the barcode value basically). If your plan was to limit the amount of loyalty cards to loop over, you could still just use
getLoyaltyCardCursorand limit it by the store instead of creating a new function. The DBHelper class is already way too complex, so I'd rather prevent extra complexity there whenever possible.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I know it's a barcode. I didn't want to compare the imported card with all the others, so I chose the barcode as a filter.
Previously, the code only compared the card with an existing card with the same ID, which led to duplicates. Since the ID is assigned randomly, it must be removed from the comparison.
This part of the code is therefore essential from a performance perspective.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, not really, you can also just call one of the existing
getLoyaltyCardCursorfunctions and use the store name as the filter. In fact that would be better, because a cursor lets you loop over the results without loading them all into memory :)I do agree that removing the database ID from the comparison is correct though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's think about a reality.
How many users want to have multiple cards with same Barcode?
How many users want to have multiple cards with same store name?
Both of these are very rare, but I think that the first one is absolutely illogical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reality is that both will be fairly rare, but the second one doesn't need a new function. And thus is cleaner and easier for long-term maintenance of the codebase.