-
-
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
Fix for issue #4652: Add Find Unlinked Files Filter based on Date #7846
Conversation
Change getDisplayText to display the last edited time
The DateRange enum contains the different date range names to be displayed on the newly created "select by date" filter on the unlinked files dialog window.
Create the ViewModel object for the ExternalFilesDate field that will be an applicable search filter for external files.
The method has similar functionality to getDisplayText with the difference that it also returns the last edited date of a file to be displayed.
The file contains the implementation of the functionality for filtering the unlinked files by specified filters.
Create the view model representing a selected sort-by method.
Add the methods for sorting the unlinked local files based on last edited date.
Import java.util.List that was used, but not imported.
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.
some optimizations for the test code, otherwise lgtm
src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java
Outdated
Show resolved
Hide resolved
* Use streams instead of creating new arrays. * Use assertEquals and assertNotEquals instead of assertArrayEquals and assertFalse.
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.
4 issues I saw to make the changes more simple.
src/main/java/org/jabref/gui/externalfiles/ExternalFilesDateViewModel.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/externalfiles/FileFilterUtils.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/externalfiles/FileFilterUtils.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/externalfiles/FileSortViewModel.java
Outdated
Show resolved
Hide resolved
Hello @Siedlerchr and @calixtus , we have addressed your suggestions. We are open to any further remarks. |
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.
Some more small ideas
this.dateFilterList = FXCollections.observableArrayList( | ||
DateRange.ALL_TIME, | ||
DateRange.YEAR, | ||
DateRange.MONTH, | ||
DateRange.WEEK, | ||
DateRange.DAY); |
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.
this.dateFilterList = FXCollections.observableArrayList( | |
DateRange.ALL_TIME, | |
DateRange.YEAR, | |
DateRange.MONTH, | |
DateRange.WEEK, | |
DateRange.DAY); | |
this.dateFilterList = FXCollections.observableArrayList(DateRange.values()); |
this.fileSortList = FXCollections.observableArrayList( | ||
ExternalFileSorter.DEFAULT, | ||
ExternalFileSorter.DATE_ASCENDING, | ||
ExternalFileSorter.DATE_DESCENDING); |
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.
this.fileSortList = FXCollections.observableArrayList( | |
ExternalFileSorter.DEFAULT, | |
ExternalFileSorter.DATE_ASCENDING, | |
ExternalFileSorter.DATE_DESCENDING); | |
this.fileSortList = FXCollections.observableArrayList(ExternalFileSorter.values()); |
Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
…sDialogViewModel Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
Thanks @calixtus for the quick response, we commited your suggestions and we rearranged the sequence of DateTime Enums in order to have the correct order when the values() method is invoked |
LOGGER.error("Could not retrieve file time", e); | ||
} | ||
LocalDateTime localDateTime = lastEditedTime | ||
.toInstant() |
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.
IntelliJ complains here, that toInstant may throw a NPE. This seems possible, since you don't return when a IOException occurs. Is that something we should think about?
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.
Thanks @calixtus , so maybe we need to place the code in a try catch-block to handle the NPE or in the same try catch block so when an IO Exception occurs the toInstant() method call is omited.
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.
Well, there must be a value returned from this method... Which one, if getLastModifiedTime fails?
Today? null?
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, sorry you are right, we will return LocalDateTime.now() when an IOException occurs
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.
Looks good to me now. Thanks!
Thank you very much @calixtus, we also face a problem regarding passing the github action check regarding the creation of the installer and portable version for macOS. Thanks in advance. |
LGTM as well! You can ignore the mac, the action doesn't work on forks because it requires access to some secrets (and that are not avaiable on forks) |
Thank you very much, so the only thing left now is to deal with the NPE @calixtus mentioned? |
As soon as the tests are green, we can merge. Thanks! |
Guys me and @gliargovas want to thank you very much for the cooperation and the help you offered us to deal with this issue, everything was great. We are more than happy to be part of this Community! |
You're welcome. We really appreciate your work you put in JabRef. |
I can only fully agree with @calixtus, this was excellent work! We hope to see more from you in the future! :) |
* upstream/main: (26 commits) Add unit test to four test classes (#7651) Fix IEEE test (#7852) New Crowdin updates (#7859) Fix markdown syntax of ADRs add missing l10n (#7857) New Crowdin updates (#7847) Bump mockito-core from 3.11.1 to 3.11.2 (#7856) Bump checkstyle from 8.43 to 8.44 (#7855) Fix for issue #4652: Add Find Unlinked Files Filter based on Date (#7846) Fix for entering a backslash in the custom entry preview dialog (#7851) Fixed INSPIREFetcherTest Fixed TitleFetcherTest Ignore baeldung.com and tldrlegal.com from out link checks New Crowdin updates (#7845) New Crowdin updates (#7843) Refactoring and addition of unit tests (#7597) CLI option to write XMP metadata to pdfs (#7814) Add query validation for web search (#7809) change eclipse default output dir (#7842) Bump lucene-queryparser from 8.8.2 to 8.9.0 (#7835) ...
…kflow-for-slr-search * upstream/main: (31 commits) New translations JabRef_en.properties (German) (#7868) Fix test "higherTrustLevelWins()" (#7866) Change WM_CLASS to jabref (#7858) [Bot] Update CSL styles (#7865) Add unit test to four test classes (#7651) Fix IEEE test (#7852) New Crowdin updates (#7859) Fix markdown syntax of ADRs add missing l10n (#7857) New Crowdin updates (#7847) Bump mockito-core from 3.11.1 to 3.11.2 (#7856) Bump checkstyle from 8.43 to 8.44 (#7855) Fix for issue #4652: Add Find Unlinked Files Filter based on Date (#7846) Fix for entering a backslash in the custom entry preview dialog (#7851) Fixed INSPIREFetcherTest Fixed TitleFetcherTest Ignore baeldung.com and tldrlegal.com from out link checks New Crowdin updates (#7845) New Crowdin updates (#7843) Refactoring and addition of unit tests (#7597) ... # Conflicts: # src/main/resources/l10n/JabRef_en.properties
Hello everyone, we made 3 additions to the Find Unlinked Files Function as following:
Finally, we made it possible to sort the files based on the date of the last modification.
For future steps, we plan to:
Fixes #4652
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)