Skip to content
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 sorting of entries on save #1054

Merged
merged 1 commit into from
Mar 31, 2016
Merged

Conversation

tobiasdiez
Copy link
Member

Fix sorting of entries on save (this shouldn't affect the sorting of export, so is unrelated to #1051). In the end it was just a wrong boolean in the preference.

  • Change in CHANGELOG.md described - no, I think the issue was introduced in this version
  • Tests created for changes - kind of, there is a test for the sorting now but it passed before any fix, no test added for the boolean in the preference
  • Screenshots added (for bigger UI changes)

@tobiasdiez tobiasdiez added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Mar 28, 2016
@@ -51,7 +51,7 @@ public static SavePreferences loadForExportFromPreferences(JabRefPreferences pre
}

public static SavePreferences loadForSaveFromPreferences(JabRefPreferences preferences) {
Boolean saveInOriginalOrder = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure I'm commenting on the right thing, but I am sure that the consensus is that the default should be to save in original order. It might be that this switch cannot be changed in the preferences, but then that issue should be solved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is true. If no explicit sort order is set in the meta data, the entries should be saved in the original order (to modify as little in the file as possible).

As far as I can see there is currently no test for that. Could you perhaps add one in this PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a corresponding test. If saveInOriginalOrder is set to true, then even the save order specified in the metadata is ignored.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, do I understand you correctly @tobiasdiez: The preference saveInOriginalOrder overwrites meta data in the file? If so, then this is a problem, because the serialization can differ between machines. That harms version-controllability, our top aim regarding the serialization.

I think meta data that is explicitly written into the file should always be followed above user-specific preferences.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes saveInOriginalOrder = true let JabRef ignore the save order specified in the metadata. It was a bug that this was set for the save procedure (fixed in this PR). So now the metadata is taken into account for saves. For exports, user can choose to always export in the original order (see Preference dialog) regardless of what was specified in the metadata (and this preference option is the whole purpose of the boolean variable).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, great! Then, I'll have a last check and merge this PR.

@koppor
Copy link
Member

koppor commented Mar 30, 2016

Context:

  • Decision to add new entries at the end
  • User wants to have other sort options
  • User wants to have other sort options as default

The idea is that a user can configure a bib template, which contains the default "preferences" for a database, such as the bibtex key patterns and the sort order configuration. When the user creates a new bib file, the template is used.

We discussed sometime ago the plethora of preferences. Maybe that approach could help to reduce that. However, the system of a bib template could increase complexity. Since I care for sharing and group editing of bib files, I want to a) have as much as possible bib-affecting configurations (directory, key patterns, ...) in the bib file itself (See for instance #180) and b) enable new users to have a properly configured bib file and not requiring an expert to configure JabRef.

a) is IMHO mostly achieved
b) is some thing we are working on to have correct default settings. My personal feeling is that some groups, however, do not want to follow our conventions (for instance, bibtex keys, sort order) and thus require different settings.

Maybe I should open a separate issue asking for support of "bib template". 😇

@tobiasdiez
Copy link
Member Author

@koppor commented on the wrong issue?

@koppor
Copy link
Member

koppor commented Mar 30, 2016

@tobiasdiez No, not the wrong issue. I tried to give some context above. Hope, that helps to understand my text.

@lenhard lenhard merged commit 3d6add4 into JabRef:master Mar 31, 2016
@tobiasdiez tobiasdiez deleted the fixDBSorting branch March 31, 2016 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants