Skip to content

Commit

Permalink
Merge pull request #536 from MetaPhase-Consulting/feature/bid_handsha…
Browse files Browse the repository at this point in the history
…ke_active

Return active and active_handshake_perdet status to bureau position
  • Loading branch information
mjoyce91 authored May 26, 2021
2 parents 3cd12bb + a574ae8 commit 2005a2e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
22 changes: 22 additions & 0 deletions talentmap_api/bidding/services/bidhandshake.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import logging
import pydash

from talentmap_api.bidding.models import BidHandshake

logger = logging.getLogger(__name__)


def get_position_handshake_data(cp_id):
'''
Return whether the cycle position is active, and if so, to which perdet possesses the active handshake
'''
props = {
'active_handshake_perdet': None,
}

perdet = BidHandshake.objects.filter(cp_id=cp_id).exclude(status='R').values_list("bidder_perdet", flat=True)

if perdet:
props['active_handshake_perdet'] = perdet.first()

return props
5 changes: 5 additions & 0 deletions talentmap_api/fsbid/services/bureau.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import talentmap_api.fsbid.services.bid as bid_services
import talentmap_api.fsbid.services.cdo as cdoservices
import talentmap_api.bidding.services.bidhandshake as bh_services
import talentmap_api.fsbid.services.common as services

from talentmap_api.available_positions.models import AvailablePositionRanking
Expand Down Expand Up @@ -140,6 +141,9 @@ def fsbid_bureau_positions_to_talentmap(bp):
'''
Converts the response bureau position from FSBid to a format more in line with the Talentmap position
'''

bh_props = bh_services.get_position_handshake_data(bp.get("cp_id", None))

hasHandShakeOffered = False
if bp.get("cp_status", None) == "HS":
hasHandShakeOffered = True
Expand Down Expand Up @@ -261,6 +265,7 @@ def fsbid_bureau_positions_to_talentmap(bp):
"has_handshake_offered": hasHandShakeOffered,
"has_handshake_accepted": None
}],
"bid_handshake": bh_props,
"unaccompaniedStatus": bp.get("us_desc_text", None),
"isConsumable": bp.get("bt_consumable_allowance_flg", None) == "Y",
"isServiceNeedDifferential": bp.get("bt_service_needs_diff_flg", None) == "Y",
Expand Down

0 comments on commit 2005a2e

Please sign in to comment.