kitodo-production icon indicating copy to clipboard operation
kitodo-production copied to clipboard

Setting the ORDERLABEL to excluded breaks the pagination

Open BartChris opened this issue 3 years ago • 8 comments

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:

https://github.com/kitodo/kitodo-production/issues/5220#issuecomment-1208031116


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

BartChris avatar Jul 06 '22 16:07 BartChris

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

matthias-ronge avatar Jul 07 '22 12:07 matthias-ronge

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:

https://github.com/kitodo/kitodo-production/blob/f3ccd642f01f63cc0c4df2ab148b08f551e181bf/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/EditPagesDialog.java#L255-L260

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

https://github.com/kitodo/kitodo-production/blob/f3ccd642f01f63cc0c4df2ab148b08f551e181bf/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/EditPagesDialog.java#L242-L243

is also different from

the one in the StructurePanel class

https://github.com/kitodo/kitodo-production/blob/f3ccd642f01f63cc0c4df2ab148b08f551e181bf/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java#L695-L700

BartChris avatar Jul 13 '22 17:07 BartChris

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.

illipsum avatar Jul 18 '22 10:07 illipsum

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

IkramMaalej avatar Jul 19 '22 10:07 IkramMaalej

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

https://user-images.githubusercontent.com/51130057/179744273-120aee6c-c951-4520-af67-0b3ca9c1a72d.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.

illipsum avatar Jul 19 '22 12:07 illipsum

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 https://github.com/kitodo/kitodo-production/issues/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 https://github.com/kitodo/kitodo-production/issues/4921)

BartChris avatar Aug 04 '22 15:08 BartChris

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

subhhwendt avatar Aug 05 '22 12:08 subhhwendt

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.

matthias-ronge avatar Aug 08 '22 11:08 matthias-ronge