kitodo / kitodo-production

Kitodo.Production is a workflow management tool for mass digitization and is part of the Kitodo Digital Library Suite.
http://www.kitodo.org/software/kitodoproduction/
GNU General Public License v3.0
63 stars 63 forks source link

Setting the ORDERLABEL to excluded breaks the pagination #5220

Open BartChris opened 2 years ago

BartChris commented 2 years ago

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

matthias-ronge commented 2 years ago

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 commented 2 years ago

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 selectFirstPageSelectedItemhas 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 StructurePanelclass

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

illipsum commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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.

BartChris commented 2 years ago

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)

subhhwendt commented 2 years ago

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

matthias-ronge commented 2 years ago

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.