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

Introduce OpenOrder Logic and Components for 'Overbygningmaterialer' #469

Conversation

kasperbirch1
Copy link
Contributor

@kasperbirch1 kasperbirch1 commented May 31, 2023

Link to issue

https://reload.atlassian.net/browse/DDFSOEG-528

Description

This PR introduces the logic and components for ordering a book from 'overbygningmaterialer' (openOrder).

To determine that the material is available as an 'overbygningmateriale', I have made a function called getReservableOnAnotherLibrary. This function returns a boolean and a list of PIDS that start with 'OVE' in otherCatalogues.

I have created a new graphql mutation called openOrder that is called instead of the normal reservation inside the ReservationModalBody.

Because the response is so different from the normal reservation, I have made a separate component called OpenOrderResponse that handles the messages that are returned.

I have added a unit test for the getReservableOnAnotherLibrary and a cypress e2e test that shows different messages depending on the response.

Screenshot of the result

Checklist

  • My complies with our coding guidelines.
  • My code passes our static analysis suite. If not then I have added a comment explaining why this change should be exempt from the code standards and process.
  • My code passes our continuous integration process. If not then I have added a comment explaining why this change should be exempt from the code standards and process.

Additional comments or questions

@kasperbirch1 kasperbirch1 reopened this Sep 18, 2023
@kasperbirch1 kasperbirch1 force-pushed the DDFSOEG-529-udvid-bestillingsknapper-med-bestil-pa-andet-bibliotek-s-knap branch from 03db65c to c9764b3 Compare September 18, 2023 09:01
@kasperbirch1 kasperbirch1 force-pushed the DDFSOEG-529-udvid-bestillingsknapper-med-bestil-pa-andet-bibliotek-s-knap branch from a4c3d2b to 7c23601 Compare September 26, 2023 13:30
@kasperbirch1 kasperbirch1 marked this pull request as ready for review September 26, 2023 13:32
@kasperbirch1 kasperbirch1 force-pushed the DDFSOEG-529-udvid-bestillingsknapper-med-bestil-pa-andet-bibliotek-s-knap branch 2 times, most recently from 05c5f02 to e19a754 Compare September 27, 2023 12:42
@kasperbirch1 kasperbirch1 force-pushed the DDFSOEG-529-udvid-bestillingsknapper-med-bestil-pa-andet-bibliotek-s-knap branch from e19a754 to 0feb17f Compare September 27, 2023 12:47
@kasperbirch1 kasperbirch1 changed the title Add MaterialButtonReservableOnAnotherLibrary button Introduce OpenOrder Logic and Components for 'Overbygningmaterialer' Sep 27, 2023
Copy link
Contributor

@spaceo spaceo left a comment

Choose a reason for hiding this comment

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

Great work. I have some comments though

src/apps/material/material.dev.tsx Outdated Show resolved Hide resolved
src/components/reservation/OpenOrderResponse.tsx Outdated Show resolved Hide resolved
src/core/utils/helpers/general.ts Show resolved Hide resolved
src/core/utils/helpers/general.ts Outdated Show resolved Hide resolved
src/components/reservation/helper.ts Outdated Show resolved Hide resolved
src/components/reservation/helper.ts Outdated Show resolved Hide resolved
src/components/reservation/ReservationModalBody.tsx Outdated Show resolved Hide resolved
@kasperbirch1 kasperbirch1 self-assigned this Oct 5, 2023
This is needed to determine if the manifestation can be reserved at another library (overbygningsmaterialer).
This is used to handle overbygningsmaterialer (openOrder)
- Implemented a new function `getReservableOnAnotherLibrary` to verify if a material is categorized as "overbygningsmateriale". This function returns both a boolean and a list of PIDs.
- Utilized `getReservableOnAnotherLibrary` function to determine the visibility of the `MaterialButtonReservableOnAnotherLibrary` button.
- Introduced a new component, `OpenOrderResponse`, as the `ReservationSuccess` does not have the same response structure.
- Added `translateOpenOrderStatus` to interpret and display the response status.
After adding catalogueCodes, the mocked data/fixtures were no longer up-to-date.
To unify modal response handling
…PidsFromAnotherLibrary`

Previously, we returned both 'isReservable' and a list of 'pids'. Now, we only return the list of pids and check its length to determine, for example, if the button should change its name.
Replacing the switch-case statement with a mapping object
@kasperbirch1 kasperbirch1 force-pushed the DDFSOEG-529-udvid-bestillingsknapper-med-bestil-pa-andet-bibliotek-s-knap branch from 2579cd0 to 11bd97a Compare October 6, 2023 10:11
@kasperbirch1 kasperbirch1 requested a review from spaceo October 6, 2023 12:03
@kasperbirch1 kasperbirch1 assigned spaceo and unassigned kasperbirch1 Oct 6, 2023
@spaceo spaceo removed their assignment Oct 6, 2023
Copy link
Contributor

@spaceo spaceo left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@kasperbirch1 kasperbirch1 merged commit 5c0c7c1 into danskernesdigitalebibliotek:develop Oct 9, 2023
@kasperg kasperg deleted the DDFSOEG-529-udvid-bestillingsknapper-med-bestil-pa-andet-bibliotek-s-knap branch October 9, 2023 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants