RequisitionLineCalculationService initiate beginning balance gets wrong previous period

Description

The initateBeginningBalance method in this service gets a list of periods earlier than the requisition's period start date (previous periods), takes the first one in the list, and assumes it is the most recent previous period. This assumption seems to be incorrect, as the external call orders the previous periods by start date ascending. So the first one in the list would be least recent previous period.

Acceptance criteria:

  • Refactor the code that gets the previous requisition to use the most recent previous period to determine the previous requisition

Test

  • Create two previous periods with different balances and check requisition uses the correct previous period to initiate a beginning balance

Environment

None

Assignee

Sebastian Brudziński

Reporter

Chongsun Ahn

Labels

None

Sprint

None

Fix versions

Priority

Minor
Configure