Skip to content

[OBPIH-6515] Unify location search on outbound import with regular outbound creation#4808

Merged
awalkowiak merged 2 commits intofeature/outbound-importfrom
bugfix/OBPIH-6515-filter-destinations-by-location-group-and-type-in-full-outbound-import-details-page
Aug 29, 2024
Merged

[OBPIH-6515] Unify location search on outbound import with regular outbound creation#4808
awalkowiak merged 2 commits intofeature/outbound-importfrom
bugfix/OBPIH-6515-filter-destinations-by-location-group-and-type-in-full-outbound-import-details-page

Conversation

@drodzewicz
Copy link
Collaborator

@drodzewicz drodzewicz commented Aug 29, 2024

✨ Description of Change

A concise summary of what is being changed. Please provide enough context for reviewers to be able to understand the change and why it is necessary. If the issue/ticket already provides enough information, you can put "See ticket" as the description.

Link to GitHub issue or Jira ticket: OBPIH-6515

Description:
The issue was that locations returned on import outbound workflow were a different set of locations than on regular outbound, the difference was that on regular outbound creation we send a request to locations api with direction=OUTBOUND parameter that was extracted from the url (for example when we are on page /openboxes/stockMovement/createOutbound?direction=OUTBOUND).

To fix this issue I have added an additional optional parameter direction to the fetch Locations service method where we can manually specify the stock movement direction, if it is not provided then the default behavior is to extract the direction parameter from the url like it worked before.


📷 Screenshots & Recordings (optional)

If this PR contains a UI change, consider adding one or more screenshots here or link to a screen recording to help reviewers visualize the change. Otherwise, you can remove this section.


📈 Test Plan

We require that all code changes come paired with a method of testing them. Please select which of the following testing approaches you've included with this change:

  • Frontend automation tests (unit)
  • Backend automation tests (unit, API, smoke)
  • End-to-end tests (Playwright)
  • Manual tests (please describe below)
  • Not Applicable

Description of test plan (if applicable):


✅ Quality Checks

Please confirm and check each of the following to ensure that your change conforms to the coding standards of the project:

  • The pull request title is prefixed with the issue/ticket number (Ex: [OBS-123] for Jira, [#0000] for GitHub, or [OBS-123, OBPIH-123] if there are multiple), or with [N/A] if not applicable
  • The pull request description has enough information for someone without context to be able to understand the change and why it is needed
  • The change has tests that prove the issue is fixed / the feature works as intended

@drodzewicz drodzewicz self-assigned this Aug 29, 2024
@github-actions github-actions bot added type: bug Addresses unintended behaviours of the app domain: frontend Changes or discussions relating to the frontend UI labels Aug 29, 2024
Comment on lines +24 to +33
const loadOutboundLocations = debounceLocationsFetch(
debounceTime,
minSearchLength,
null,
false,
false,
true,
false,
StockMovementDirection.OUTBOUND,
);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I know this looks ugly and all of the values between minSearchLength and direction are the default values.
At first I thought to extract them from a destructed object but there would be a little to much work to change each instance of debounceLocationsFetch which is called accross the whole application.

Maybe we'll do it some other day 😉

Copy link
Collaborator

Choose a reason for hiding this comment

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

@awalkowiak what do you think about creating a tech debt ticket for moving all of the debonuceXYZFetch to the hook for debounce fetching? We can also refactor those methods to take an object as an argument instead of having those ugly positional arguments.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@alannadolny sounds good

Comment on lines +1 to +4
export default {
INBOUND: 'INBOUND',
OUTBOUND: 'OUTBOUND',
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

To unify this "enum" with the backend part, please add "INTERNAL"
This is how it looks on the backend:

    INBOUND('Inbound'),
    OUTBOUND('Outbound'),
    INTERNAL('Internal')

Copy link
Collaborator

Choose a reason for hiding this comment

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

this is weird. I'm sure we've already had this enum on the frontend, but suddenly I can't find it anywhere.

Comment on lines +24 to +33
const loadOutboundLocations = debounceLocationsFetch(
debounceTime,
minSearchLength,
null,
false,
false,
true,
false,
StockMovementDirection.OUTBOUND,
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

@awalkowiak what do you think about creating a tech debt ticket for moving all of the debonuceXYZFetch to the hook for debounce fetching? We can also refactor those methods to take an object as an argument instead of having those ugly positional arguments.

@awalkowiak awalkowiak merged commit 995e7fb into feature/outbound-import Aug 29, 2024
@awalkowiak awalkowiak deleted the bugfix/OBPIH-6515-filter-destinations-by-location-group-and-type-in-full-outbound-import-details-page branch August 29, 2024 13:17
awalkowiak pushed a commit that referenced this pull request Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: frontend Changes or discussions relating to the frontend UI type: bug Addresses unintended behaviours of the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants