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

Pages added to wrong document #28

Open
ghost opened this issue Sep 17, 2021 · 3 comments
Open

Pages added to wrong document #28

ghost opened this issue Sep 17, 2021 · 3 comments
Labels
Hacktoberfest Part of hacktoberfest event

Comments

@ghost
Copy link

ghost commented Sep 17, 2021

I scanned a document with two pages and then I scanned another two page document, but assigned it the same name. This created some confusion in the app which caused the second page of the second document to be added to the first document instead.

@Breta01
Copy link
Owner

Breta01 commented Sep 17, 2021 via email

@ghost
Copy link
Author

ghost commented Sep 17, 2021

I took a quick look around the code but I didn't clearly find the code that manages this, so if you could point me to the code I might be able to propose a fix.

It seems like you're using a database to store the document info, so it might make sense to reference the document internally by it's ID in order to prevent such collisions.

@Breta01
Copy link
Owner

Breta01 commented Sep 20, 2021

Okay, I was just checking the code. The issue is in:

  • ScanPreviewFragment.java
    • Here I use documentName to pass around reference to the document between the preview and CameraFragment
    • I also use dataRepository.findByName(documentName) which obviously leads to collisions
    • Each document should have unique ID as well so it should be used instead of documentName

Adding extra function for finding documents by id (findById) will be neccessary. This should be placed in following files in a same way as findByName:

Images of pages are then saved in folder which uses naming convention: documentName-<timestamp> so that should be ok.

@Breta01 Breta01 added the Hacktoberfest Part of hacktoberfest event label Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hacktoberfest Part of hacktoberfest event
Projects
None yet
Development

No branches or pull requests

1 participant