Skip to content

Commit

Permalink
Merge pull request #499 from MetaPhase-Consulting/feature/handshake-csv
Browse files Browse the repository at this point in the history
adding new hs data to csv
  • Loading branch information
elizabeth-jimenez authored Apr 16, 2021
2 parents 1891084 + 9502b46 commit 2084e12
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 4 additions & 2 deletions talentmap_api/fsbid/services/bureau.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

from talentmap_api.common.common_helpers import ensure_date, validate_values

import talentmap_api.fsbid.services.common as services
import talentmap_api.fsbid.services.bid as bid_services
import talentmap_api.fsbid.services.cdo as cdoservices
import talentmap_api.fsbid.services.common as services

from talentmap_api.available_positions.models import AvailablePositionRanking

Expand Down Expand Up @@ -103,7 +104,8 @@ def get_bureau_position_bids_csv(self, id, query, jwt_token, host):

pos_num = get_bureau_position(id, jwt_token)["position"]["position_number"]
filename = f"position_{pos_num}_bidders"
response = services.get_bidders_csv(self, id, data, filename, True)
mappedResult = bid_services.map_bids_handshake_status_by_cp_id(data, id)
response = services.get_bidders_csv(self, id, mappedResult, filename, True)
return response

def fsbid_bureau_position_bids_to_talentmap(bid, jwt):
Expand Down
11 changes: 10 additions & 1 deletion talentmap_api/fsbid/services/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@ def get_bids_csv(data, filename, jwt_token):
headers.append(smart_str(u"Incumbent"))
headers.append(smart_str(u"Bid Cycle"))
headers.append(smart_str(u"Bid Status"))
headers.append(smart_str(u"Handshake Status"))
headers.append(smart_str(u"Handshake Accepted/Declined by CDO"))
headers.append(smart_str(u"Capsule Description"))

writer.writerow(headers)
Expand All @@ -395,7 +397,7 @@ def get_bids_csv(data, filename, jwt_token):
ted = smart_str(maya.parse(position_data["ted"]).datetime().strftime('%m/%d/%Y'))
except:
ted = "None listed"

hs_status = record['hs_status_code'].replace('_', ' ')
row = []
row.append(smart_str(record["position"]["title"]))
row.append(smart_str("=\"%s\"" % record["position"]["position_number"]))
Expand All @@ -416,6 +418,8 @@ def get_bids_csv(data, filename, jwt_token):
row.append(smart_str("handshake_registered"))
else:
row.append(smart_str(record.get("status")))
row.append(hs_status)
row.append(smart_str(record["hs_cdo_indicator"]))
row.append(smart_str(position_data["position"]["description"]["content"]))

writer.writerow(row)
Expand Down Expand Up @@ -479,6 +483,8 @@ def get_bidders_csv(self, pk, data, filename, jwt_token):
headers.append(smart_str(u"TED"))
headers.append(smart_str(u"CDO"))
headers.append(smart_str(u"CDO Email"))
headers.append(smart_str(u"Handshake Status"))
headers.append(smart_str(u"Handshake Accepted/Declined by CDO"))

writer.writerow(headers)

Expand All @@ -498,6 +504,7 @@ def get_bidders_csv(self, pk, data, filename, jwt_token):
cdo_name = ''
cdo_email = ''

hs_status = record['hs_status_code'].replace('_', ' ')
record['has_competing_rank'] = has_competing_rank(self, record.get('emp_id'), pk)
row = []
row.append(smart_str(record["name"]))
Expand All @@ -510,6 +517,8 @@ def get_bidders_csv(self, pk, data, filename, jwt_token):
row.append(ted)
row.append(cdo_name)
row.append(cdo_email)
row.append(hs_status)
row.append(smart_str(record["hs_cdo_indicator"]))

writer.writerow(row)
return response
2 changes: 1 addition & 1 deletion talentmap_api/fsbid/views/bureau.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,6 @@ class FSBidBureauPositionBidsExportView(BaseView):

def get(self, request, pk):
'''
Gets all bureau positions for export
Gets a bureau position's bids for export
'''
return services.get_bureau_position_bids_csv(self, pk, request.query_params, request.META['HTTP_JWT'], f"{request.scheme}://{request.get_host()}")

0 comments on commit 2084e12

Please sign in to comment.