-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Duplicate check on importing in find unlinked files #12076
base: main
Are you sure you want to change the base?
Conversation
Fix for issue koppor#551
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.
Small initial comment while on the road.
@@ -1052,6 +1052,10 @@ public KeywordList getFieldAsKeywords(Field field, Character keywordSeparator) { | |||
return keywords; | |||
} | |||
|
|||
public Optional<String> getCiteKey() { |
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.
Remove. Use
public Optional<String> getCitationKey() { |
Move method below up, too.
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.
Updated: getCiteKey() has been removed.
@@ -166,10 +188,49 @@ public void startImport() { | |||
progressTextProperty.unbind(); | |||
taskActiveProperty.setValue(false); | |||
}) | |||
.onSuccess(resultList::addAll); | |||
.onSuccess(new Consumer<List<ImportFilesResultItemViewModel>>() { | |||
@Override |
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.
You can use a lambda here directly no need for anonymous method, Intellij should offer you that already
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.
Replaced with a lambda now
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.
Unfortunately, this is implemented way too compilcated.
The PDF file is NOT changed if the dialog is opended. Thus, one "just" needs to query the library if any file is attached to the entry.
Use entry.getFiles()
, convert each path to an absolute one and check for the file.
You could also store in the dialog the set of imported paths and just check for equality when another path is requested to be imported.
This PR resolves the issue of duplicate entries being imported when clicking the "Import" button multiple times by refining the import process.
"Closes koppor#551".
Key Changes:
UnlinkedFilesDialogViewModel Class:
edit startImport Method:
ImportHandler.getEntriesToImport
method to retrieve a list of entries.importHandler.findDuplicate
method.add getFilePathFromEntry Method:
BibEntry
.ImportHandler Class:
BibEntry
objects.BibEntry Class:
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)