Skip to content

OBPIH-6215 Implement displayStatus method for returns with util, that…#4587

Merged
awalkowiak merged 1 commit intofeature/upgrade-to-grails-3.3.10from
OBPIH-6215-v2
Apr 23, 2024
Merged

OBPIH-6215 Implement displayStatus method for returns with util, that…#4587
awalkowiak merged 1 commit intofeature/upgrade-to-grails-3.3.10from
OBPIH-6215-v2

Conversation

@kchelstowski
Copy link
Collaborator

… can be extended to other workflows

Comment on lines +39 to +40
Location currentLocation = AuthService.currentLocation
return getStockMovementDirection(currentLocation) == StockMovementDirection.INBOUND
Copy link
Collaborator

Choose a reason for hiding this comment

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

Basically, if the currentLocation is used only once, I don't see a need to create a new variable for that 🤔

Suggested change
Location currentLocation = AuthService.currentLocation
return getStockMovementDirection(currentLocation) == StockMovementDirection.INBOUND
return getStockMovementDirection(AuthService.currentLocation) == StockMovementDirection.INBOUND

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For me it looked cleaner to keep it in a separate variable. It might not make a sense from the „memory” POV, but readability is also important.
If you guys prefer not creating a variable for that, then I’ll change it.

Copy link
Collaborator

@alannadolny alannadolny Apr 22, 2024

Choose a reason for hiding this comment

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

To be honest, for me, the readability is the same in both cases, but I got your point of view, so lgtm

Comment on lines +28 to +36
StockMovementDirection getStockMovementDirection(Location currentLocation) {
if (currentLocation == origin) {
return StockMovementDirection.OUTBOUND
}
if (currentLocation == destination || origin?.isSupplier()) {
return StockMovementDirection.INBOUND
}
return null
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't it be better to somehow adjust the code to use the method from StockMovement? Or it is not possible? Maybe you can make it static and call it by StockMovement.getStockMovementDirection?
image

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 think it’s better to keep it in the helper class, because otherwise I’d have to refactor the existing method in the StockMovement to receive the locations in the params etc.
I think this helper class should be „a central place” for any type of DTOs we have (StockMovement, OutboundStockMovement, etc.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

@alannadolny alannadolny left a comment

Choose a reason for hiding this comment

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

And maybe it would be worth to write some quick unit tests for that helper class? resolved ✔️

@kchelstowski
Copy link
Collaborator Author

And maybe it would be worth to write some quick unit tests for that helper class?

I wouldn’t say there is a sense to do it now, since this can be extended and refactored for Dariusz’s needs for regular SMs.

@alannadolny
Copy link
Collaborator

Ok, that sounds good to me

@awalkowiak awalkowiak merged commit 0b60419 into feature/upgrade-to-grails-3.3.10 Apr 23, 2024
@awalkowiak awalkowiak deleted the OBPIH-6215-v2 branch April 23, 2024 18:12
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.

3 participants