Skip to content

OBPIH-6369 Receiving : Receipt not complete after using "Edit" to change item#4901

Merged
awalkowiak merged 3 commits intodevelopfrom
OBPIH-6369
Oct 22, 2024
Merged

OBPIH-6369 Receiving : Receipt not complete after using "Edit" to change item#4901
awalkowiak merged 3 commits intodevelopfrom
OBPIH-6369

Conversation

@alannadolny
Copy link
Collaborator

No description provided.

@alannadolny alannadolny self-assigned this Oct 18, 2024
@github-actions github-actions bot added the domain: backend Changes or discussions relating to the backend server label Oct 18, 2024

void setupSpec() {
mockDomain Receipt
mockDomain Shipment
Copy link
Member

Choose a reason for hiding this comment

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

for future reference, you can do mockDomains(Receipt, Shipment)

void 'savePartialReceiptEvent should create RECEIVED event when partial receiving is not supported'() {
given:
Location location = Stub(Location) {
supports(_ as ActivityCode) >> false
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason not to specify the actual enum value here? It makes things a bit more clear in my opinion and also guarantees that we're entering the proper flow.

Same for all the other tests.

Suggested change
supports(_ as ActivityCode) >> false
supports(ActivityCode.PARTIAL_RECEIVING) >> false

shipment.destination)
}
} else {
if (!shipment.wasReceived() && (!shipment.destination.supports(ActivityCode.PARTIAL_RECEIVING) || shipment.isFullyReceived())) {
Copy link
Member

@ewaterman ewaterman Oct 18, 2024

Choose a reason for hiding this comment

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

why are we even allowing the flow to continue here if partial receiving is disabled for the location? Shouldn't we error instead?

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 don't know why we call this feature "partial" everywhere, because all those functions simultaneously support partial / not partial receiving. That's the reason for allowing it here; if partial receiving is disabled, we can receive it only once.

import spock.lang.Unroll

@Unroll
class ReceiptServiceSpec extends Specification implements ServiceUnitTest<ReceiptService>, DataTest {
Copy link
Member

@ewaterman ewaterman Oct 18, 2024

Choose a reason for hiding this comment

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

Great job writing tests!

It'd probably also be worth testing these scenarios:

  1. partial receiving is enabled, it was partially received before, and now it's fully received (received event should happen)
  2. partial receiving is enabled, it was partially received before, and it still is (no events should happen)
  3. partial receiving is enabled, it was fully received before, and it still is (no events should happen)

shipment.destination)
}
} else {
if (!shipment.wasReceived() && (!shipment.destination.supports(ActivityCode.PARTIAL_RECEIVING) || shipment.isFullyReceived())) {
Copy link
Member

Choose a reason for hiding this comment

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

also, I'm not totally sure about this new flow. The old flow looked correct to me. Mainly:

// We're fully receiving
if (fully received now) {
  if (it was not already in fully received status) {
    create fully received event
  }
}
// We're partially receiving
else if (it was not already in partially received status) {
  create partial received event
}

so I'm wondering if there's an issue not with this class but with shipment.isFullyReceived(). Or maybe I'm just misunderstanding. I haven't had a chance to dig much deeper into the code

@awalkowiak awalkowiak merged commit 61bd7c0 into develop Oct 22, 2024
@awalkowiak awalkowiak deleted the OBPIH-6369 branch October 22, 2024 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: backend Changes or discussions relating to the backend server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants