inveniosoftware / react-invenio-app-ils

Single Page App built with React for InvenioILS.
https://react-invenio-app-ils.readthedocs.io
MIT License
5 stars 19 forks source link

Loans: loan already requested modal removed from first loan. #506

Closed Pineirin closed 2 years ago

Pineirin commented 2 years ago

Loan already requested modal added to the rest of loans. closes: https://github.com/CERNDocumentServer/cds-ils/issues/664 implements https://github.com/inveniosoftware/react-invenio-app-ils/pull/507 Screenshot from 2021-11-16 11-12-12 Now the modal appears for the second loan (and not the first). Hovering in the link of the modal we can see it Links correctly to the first loan. Screenshot from 2021-11-16 11-12-35

ntarocco commented 2 years ago

Wrong push?

Pineirin commented 2 years ago

Explanation of the change. The bug was caused because the function used to order by start date was giving the results inverted. This caused undesired results like, for example, that the list were not properly ordered. https://github.com/CERNDocumentServer/cds-ils/issues/627 Also, like in the related issue, it can lead to a warning modal appearing were it shouldn't a not appearing where it should. This is due to the last loan being identified as the first, so if you try to checkout any other loan (like the first) it will tell you that there is a preceding one, and if you try to checkout this last loan it would not warn you, as the logic would detect it as the first. The change was implemented as part of the solution in https://github.com/inveniosoftware/react-invenio-app-ils/pull/507, but I wanted to create this PR to show what was the bug and how it was solved.