-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Fix when fetching from DOI: Dialog selects field data based on validity #12826
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
base: main
Are you sure you want to change the base?
Conversation
src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowView.java
Outdated
Show resolved
Hide resolved
…ear. Added comment to clarify processing of work from year 1800 or before.
src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowView.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowView.java
Outdated
Show resolved
Hide resolved
@ThiloteE please let us know if the changes are good. |
@koppor Please let us know what you think. |
src/main/java/org/jabref/gui/mergeentries/FetchAndMergeEntry.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/mergeentries/FetchAndMergeEntry.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowView.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowView.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowView.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowView.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowView.java
Outdated
Show resolved
Hide resolved
Move logic to |
Suggested change Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
Moved Logic from FieldRowView.java to FieldRowViewModel.java
src/main/java/org/jabref/gui/mergeentries/newmergedialog/ThreeWayMergeView.java
Show resolved
Hide resolved
src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowViewModel.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowViewModel.java
Show resolved
Hide resolved
src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowViewModel.java
Show resolved
Hide resolved
@koppor Hi I have implemented the changes you requested, please let us know if you need any more changes. |
* If the local year is out of a reasonable range (e.g., before 1800 or 100 years after current year as determined by the System Clock) or differs from the DOI year by more than 10 years, it will choose the more recent year out of the two. | ||
*/ | ||
public void autoSelectBetterValue() { | ||
String field_1 = getField().getDisplayName(); |
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.
Bad variable name - please be consistent with others
if (field_1 == null) { | ||
return; | ||
} | ||
field_1 = field_1.trim().toLowerCase(); |
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.
What is this? When can dispalyname be null? Why toLowerCase
? - we also have .getName
- not sure what this code aims vor.
|
||
// Logic for auto selection based on field name | ||
// Default is right value | ||
if ("year".equals(field_1)) { |
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.
Please use standard fiels - as I dold you in the last review
No, you did not. I am pretty sure, I told you to use JabRefs fields instead of strings |
This informaion is new to us. You needed 20 days to come up with a pull request. You did address my previous review comments properly. The good thing is that you reacted fast on my review replies. Maybe, we can manage that your PR will be ready to be merged. Currently, I think, it will need two more rounds. |
… selected entry type.
@trag-bot didn't find any issues in the code! ✅✨ |
@koppor Sorry about that. Now the method |
You committed your code on the |
Yes. Please take this as excersie to level-up your tooling and coding skills. To get better than competitors. Please scroll through your diff https://github.com/JabRef/jabref/pull/12826/files I think, you did not understand what I meant to use -- For the purpose of getting the task done, this is solved. But I cannot merge since it does not meet our expectations of code quality. -- It is even hard for AI to work with non-good code, thus we try to have good code. I think, nearly all of your lines have to be changed. |
@xts2002 Please read my 5 day old comment: #12826 (comment). The logic is not yet moved to there. Now you use Strings. If the logic is there, you can use higher-level data structures. |
More information on MVVM can be found at https://github.com/JabRef/jabref/wiki/Code---JavaFX |
Closes #12549
This PR enhances the Merge Entries Dialog by improving the automatic selection of bibliographic fields when merging entries from a DOI with manual entries. Previously, the dialog always prioritized data from the mannual entry, even when the mannual entry contained clearly incorrect information. Now, when merging from a DOI, the system automatically selects the more reliable fields for:
Year: If the local year is out of a reasonable range (e.g., before 1800 or after 2100) or differs from the DOI year by more than 10 years it will choose the more recent year out of the two.
Entry Type: If the local entry type is "misc," it defaults to the type provided by the DOI.
Code Changes:
How It Works:
Testing:
Visuals of change effects:
Before change:

After change:

After change:

Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if change is visible to the user)