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

Activity

Show:
Łukasz Lewczyński
October 20, 2016, 9:03 AM

I added missing requisition line items. You should be able to test this ticket by simple creating new requisition for program: dce17f2e-af3e-40ad-8e00-3496adef44c3, facility: e6799d64-d10d-4011-b8c2-0e4d4a3f65ce and emergency: false

Pengfei Cui
October 20, 2016, 9:09 AM

SUCCESS: Integrated in

OpenLMIS-requisition-service-Sonar #406
OLMIS-1156: Added missing requisition line items (llewczynski: eef8cfe248ce86ac123adf073c73dc55918e3852)

Pengfei Cui
October 20, 2016, 9:28 AM

SUCCESS: Integrated in

OpenLMIS-requisition-service #656
OLMIS-1156: Improved demo data (FEOLMIS-360) (llewczynski: 7b7a9810c75636544dc7beca4b08207a3a29ec45)

Pengfei Cui
October 20, 2016, 9:34 AM

SUCCESS: Integrated in

OpenLMIS-requisition-service-Sonar #408
OLMIS-1156: Improved demo data (FEOLMIS-360) (llewczynski: 7b7a9810c75636544dc7beca4b08207a3a29ec45)

Chongsun Ahn
October 20, 2016, 11:38 AM

Asked to update demo data to have two previous periods with line items for same products with different amounts of stock on hand. Then tested initiating a new requisition for the next processing period and verified that the beginning balance matches the most recent previous requisition, not the older one. Passed, so this is done.

Done

Assignee

Sebastian Brudziński

Reporter

Chongsun Ahn

Labels

None

Time remaining

0m

Sprint

None

Fix versions

Priority

Minor
Configure