Added MonthPlausibilityComparator to prefer normalized months#14629
Conversation
koppor
left a comment
There was a problem hiding this comment.
Please learn from last PRs We don't want to repeat the same comments over and over again.
I am sorry for causing you to repeat this feedback. I am adding the test case immediately |
koppor
left a comment
There was a problem hiding this comment.
Tests should be created using @ParameterizedTest
koppor
left a comment
There was a problem hiding this comment.
Code does not cover all cases.
Moreover, org.jabref.model.entry.Month#parse should be used to check for validity.
|
Your pull request conflicts with the target branch. Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line. |
|
Please change the test according to @koppor s comment and adapt the code. (TTD) |
|
Thanks for the guidance @koppor @HoussemNasri @calixtus. This PR has become quite complicated with the various changes and merge conflicts. I’ve decided to close it for now to rethink the approach and perhaps start fresh later. |
|
This pull requests was closed without merging. You have been unassigned from the respective issue #14457. In case you closed the PR for yourself, you can re-open it. Please also check After submission of a pull request in the CONTRIBUTING.md |
|
I think, we are close to merging now :). Please merge |
c5d8056 to
40ef8cf
Compare
|
@koppor can you once review the pr, as the pr is created way back there were lot of things happened and after having the latest changes to my branch there were few failed builds ... |
0479c71 to
b9c5f86
Compare
koppor
left a comment
There was a problem hiding this comment.
Looks good now. Thank you for following-up.
User description
Closes #14457
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)Screenshot
Merge Dialog automatically preferring the normalized month format

PR Type
Enhancement
Description
Added
MonthPlausibilityComparatorto intelligently compare month field valuesPrefers normalized months (#jun#) and integers over plain text strings
Integrated comparator into merge dialog for automatic field selection
Added comprehensive unit tests and JavaDoc documentation
Diagram Walkthrough
File Walkthrough
MonthPlausibilityComparator.java
New month field value comparator implementationjablib/src/main/java/org/jabref/logic/bibtex/comparator/plausibility/MonthPlausibilityComparator.java
FieldValuePlausibilityComparatorinterface
integers
UNDETERMINEDwhen months differ or both are unparseableMonth.isStrictFormat()methodMonth.java
Add strict format validation for month valuesjablib/src/main/java/org/jabref/model/entry/Month.java
isStrictFormat()to check if month value is instrict BibTeX format
strict format
PlausibilityComparatorFactory.java
Register month comparator in factoryjablib/src/main/java/org/jabref/logic/bibtex/comparator/plausibility/PlausibilityComparatorFactory.java
MonthPlausibilityComparatorinto factory patternFieldProperty.MONTHpropertyFieldRowViewModel.java
Enable auto-selection in field row view modeljabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/FieldRowViewModel.java
autoSelectBetterValue()in constructor initializationoperations
MonthPlausibilityComparatorTest.java
Comprehensive unit tests for month comparatorjablib/src/test/java/org/jabref/logic/bibtex/comparator/plausibility/MonthPlausibilityComparatorTest.java
comparison scenarios
UNDETERMINEDCHANGELOG.md
Document month comparator feature in changelogCHANGELOG.md
feature