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

Setting the ORDERLABEL to excluded breaks the pagination #5220

Open
BartChris opened this issue Jul 6, 2022 · 8 comments · May be fixed by #6238 or #6244
Open

Setting the ORDERLABEL to excluded breaks the pagination #5220

BartChris opened this issue Jul 6, 2022 · 8 comments · May be fixed by #6238 or #6244

Comments

@BartChris
Copy link
Collaborator

BartChris commented Jul 6, 2022

New issue description:

Describe the bug

When setting the ORDERLABEL-key to excluded in the ruleset

 <setting key="ORDERLABEL" excluded="true" editable="false"/>

a lot of pagination bugs occur in the metadata editor. See below. The only way to fix that is to not exclude the ORDERLABEL.

 <setting key="ORDERLABEL" editable="false"/>

Expected behavior
It should be possible to exclude the ORDERLABEL and still have a working pagination. A possible cause of this error is described below:

#5220 (comment)


Old description:

When a object is already paginated in the editor

grafik

and you want to add a new logical element to one or multiple pages

grafik

The pagination of one or multiple pages is reset to "uncounted" and has to be redone. Example with one page.

grafik

If you associate a logical element to multiple pages the pagination is distorted as well:

grafik

@matthias-ronge
Copy link
Collaborator

matthias-ronge commented Jul 7, 2022

The paginated value is also not showing in the dialog. It is "6 : " but should be "6 : 6".

Screenshot 2022-07-07 140439

Maybe these are related

@BartChris
Copy link
Collaborator Author

BartChris commented Jul 13, 2022

I tried to find the root cause of this critical bug which makes Kitodo not really usable in a production environment.
Unfortunately i do not understand the logic here enough, but i am quite certain, that this here is wrong:

if (Objects.isNull(selectFirstPageSelectedItem) && !selectPageItems.isEmpty()) {
selectFirstPageSelectedItem = (Integer) selectPageItems.get(0).getValue();
}
if (Objects.isNull(selectFirstPageSelectedItem) && !selectPageItems.isEmpty()) {
selectFirstPageSelectedItem = (Integer) selectPageItems.get(selectPageItems.size() - 1).getValue();
}

The second selectFirstPageSelectedItem has to be selectLastPageSelectedItem otherwise the assignments make no sense to me. This does however not fix the bug.

On a side note: the logic in

String label = Objects.isNull(physicalDivision.getOrderlabel()) ? Integer.toString(physicalDivision.getOrder())
: physicalDivision.getOrder() + " : " + physicalDivision.getOrderlabel();

is also different from

the one in the StructurePanel class

public String buildViewLabel(View view) {
String canonical = findCanonicalIdForView(view);
PhysicalDivision mediaUnit = view.getPhysicalDivision();
return canonical.replaceFirst("^0+(?!$)", "") + " : "
+ (Objects.isNull(mediaUnit.getOrderlabel()) ? "uncounted" : mediaUnit.getOrderlabel());
}

@illipsum
Copy link

This really is a killer bug, tbh. Makes the metadata editor basically unusable at this moment.
grafik
After adding several structure elements pagination was a total mess with randomly added "uncounted" pages.

@IkramMaalej
Copy link
Collaborator

Unfortunately I could not reproduce this problem with the current master version.
Can you please give us more details on the steps you took to cause this behavior?

pagination

@illipsum
Copy link

Hi Ikram, thanks for this. Here's how I did it:

Kitodo_Pagination_Bug.mp4

(I 'zoomed' in on the pagination form and structure tree, so the video looks a bit cut off)

Version is 3.4.4-Snapshot. Pagination was done for a range of pages. Another "uncounted" page was added at the position of the last page of the previously paginated range, which is not visible in the video.

@BartChris
Copy link
Collaborator Author

BartChris commented Aug 4, 2022

After investigating i found out that this is not a bug in Kitodo but a configuration problem inside the ruleset on our side. Sorry for the confusion.

As outlined in #4921 , we want to hide all metadata elements for pages because they tend to confuse the editors. So i ended up excluding the order label:
<setting key="ORDERLABEL" excluded="true" editable="false"/>

This leads to the described pagination bug. I do not yet understand how exactly the ruleset setting effeccts the processing logic and why the behaviour exists.
It probably underlines the importance of documentation on how to configure the page element correctly. (See #4921)

@subhhwendt
Copy link
Collaborator

I'm impressed by your investigation - I can confirm the success of this tiny change !

@matthias-ronge
Copy link
Collaborator

Excluded metadata is removed from the metadata internally and kept aside, when saving it is added back before saving. Maybe this doesn’t work correctly for domain="mets:div" because they are “fake” metadata which isn’t in the metadata section, but in the METS <div> element, which always need to be handled separately.

@BartChris BartChris changed the title Associating logical structures to already paginated elements breaks the pagination Setting the ORDERLABEL to excluded breaks the pagination Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants