Skip to content

Commit

Permalink
Always set overdue to false unless it's in wwsnfy (#12480)
Browse files Browse the repository at this point in the history
* Always set overdue to false unless it's in wwsnfy

* Update param

* Fix typo

* Fix guard

---------

Co-authored-by: Austin Covrig <[email protected]>
  • Loading branch information
acovrig and acovrig authored May 2, 2023
1 parent b9950f8 commit e6000da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def build_wwsnfy_items
wwsnfy.map do |item|
status = map_status(item[:dvlpmt_item_id], 'NEEDED_FROM_YOU')

build_tracked_item(find_tracked_item(item[:dvlpmt_item_id]), status, item)
build_tracked_item(find_tracked_item(item[:dvlpmt_item_id]), status, item, wwsnfy: true)
end
end

Expand Down Expand Up @@ -447,21 +447,21 @@ def accepted?(status)
'Complete'].include? status
end

def overdue?(tracked_item)
overdue_date_present?(tracked_item) ? tracked_item[:suspns_dt] < Time.zone.now : false
end
def overdue?(tracked_item, wwsnfy)
if tracked_item[:suspns_dt].present? && tracked_item[:accept_dt].nil? && wwsnfy
return tracked_item[:suspns_dt] < Time.zone.now
end

def overdue_date_present?(tracked_item)
tracked_item[:suspns_dt].present? && tracked_item[:accept_dt].nil?
false
end

def build_tracked_item(tracked_item, status, item)
def build_tracked_item(tracked_item, status, item, wwsnfy: false)
uploads_allowed = uploads_allowed?(status)
{
closed_date: date_present(tracked_item[:accept_dt]),
description: item[:items],
display_name: tracked_item[:short_nm],
overdue: overdue?(tracked_item),
overdue: overdue?(tracked_item, wwsnfy),
received_date: date_present(tracked_item[:receive_dt]),
requested_date: tracked_item_req_date(tracked_item, item),
status:,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
.to receive(:validate_id_with_icn).and_return(nil)
end

describe ' BGS attributes' do
describe 'BGS attributes' do
it 'are listed' do
lh_claim = create(:auto_established_claim, status: 'PENDING', veteran_icn: veteran_id,
evss_id: '111111111')
Expand Down Expand Up @@ -1095,6 +1095,8 @@
expect(json_response['data']['attributes']['trackedItems'][2]['requestedDate']).to eq(
'2021-05-05'
)
expect(json_response['data']['attributes']['trackedItems'][0]['overdue']).to eq(true)
expect(json_response['data']['attributes']['trackedItems'][1]['overdue']).to eq(false)
end
end
end
Expand Down

0 comments on commit e6000da

Please sign in to comment.