-
-
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
Changing a specialFieldValue does not update the sorting of entries immediately #9334
Closed
2 tasks done
Comments
Siedlerchr
added
the
bug
Confirmed bugs or reports that are very likely to be bugs
label
Oct 31, 2022
I looked into the rank-clearing issue a bit and updated the workaround to also work with zero-rankings: public ObservableValue<Optional<SpecialFieldValueViewModel>> getSpecialField(SpecialField field) {
OptionalBinding<SpecialFieldValueViewModel> value = specialFieldValues.get(field);
// Fetch already updated value from BibEntry entry
Optional<String> currentValue = this.entry.getField(field);
if (value != null) {
// BEGIN WORKAROUND
if (currentValue.isEmpty() && value.getValue().isEmpty()) {
var zeroValue = getField(field).flatMapOpt(fieldValue -> field.parseValue("CLEAR_RANK").map(SpecialFieldValueViewModel::new));
specialFieldValues.put(field, zeroValue);
return zeroValue;
} else if (value.getValue().isEmpty() || !value.getValue().get().getValue().getFieldValue().equals(currentValue)) {
value = getField(field).flatMapOpt(fieldValue -> field.parseValue(fieldValue).map(SpecialFieldValueViewModel::new));
specialFieldValues.put(field, value);
return value;
}
// END WORKAROUND
return value;
} else {
value = getField(field).flatMapOpt(fieldValue -> field.parseValue(fieldValue).map(SpecialFieldValueViewModel::new));
specialFieldValues.put(field, value);
return value;
}
} |
@SebieF We would appreciate it if you could create a PR, I think your workaround is an acceptable solution. Better than nothing. The root cause is probably somewhere in the controlsfx control not having the option to remember the previous value |
SebieF
added a commit
to SebieF/jabref
that referenced
this issue
Nov 2, 2022
6 tasks
SebieF
added a commit
to SebieF/jabref
that referenced
this issue
Nov 2, 2022
Siedlerchr
pushed a commit
that referenced
this issue
Nov 3, 2022
…9338) * Updating specialFieldValues with possibly modified value from BibEntry Workaround that is necessary because specialFieldValues and entry.fields get updated separately (entry.fields before speicalFieldValues). This lead to the behaviour that when sorting for a special field in the maintaible (like ranking or read status), the sorting does not get updated properly on change. * Updating changelog with #9334 * Removing unnecessary comment Co-authored-by: Carl Christian Snethlage <[email protected]> Co-authored-by: Carl Christian Snethlage <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
JabRef version
5.7 (latest release)
Operating system
GNU / Linux
Details on version and operating system
Ubuntu 22.04 LTS
Checked with the latest development build
Steps to reproduce the behaviour
To be more precise, I inspected the code and found that the
RankingFieldComparator
always gets called with the old rank value, not the updated one. This is due toBibEntryTableViewModel
which has both, theBibEntry entry
andMap<SpecialField, OptionalBinding<SpecialFieldValueViewModel>> specialFieldValues
attributes. TheRankingFieldComparator
is getting called with the value returned bypublic ObservableValue<Optional<SpecialFieldValueViewModel>> getSpecialField(SpecialField field)
of theBibEntryTableViewModel
object. This method returns the value from thespecialFieldValues
attribute, which, however, has not yet been updated as the comparator is called. TheBibEntry entry
field has in fact already been updated, which enables the following (dirty) workaround:I am new to JabRef, so I am not sure, why the extra
specialFieldValues
is actually needed, given that these values are already included in theBibEntry entry
itself.I like JabRef very much and am currently using it for my thesis, it is however a bit annoying to be forced to set the ranking twice by triggering the UI again. I would also be happy to create a PR for this myself, however, as already mentioned, I think that the "root cause" for the problem is nested a bit deeper, so more information would be necessary and much appreciated :)
The text was updated successfully, but these errors were encountered: