Skip to content

Commit

Permalink
Map all fields on get_campaign, and fix get_swimops_campaign to retur…
Browse files Browse the repository at this point in the history
…n gracefully if no operations
  • Loading branch information
pamela-joslyn-4ss committed Nov 22, 2024
1 parent e6b0fb0 commit f057f36
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion fourinsight/campaigns/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,11 @@ def get_campaign(self, campaign_id):
"""
response_map = {
("id", "CampaignID"): None,
("projectnumber", "Project Number"): None,
("campaignname", "Name"): None,
("campaigntype", "Type"): None,
("client", "Client"): None,
("ponumber", "PO Number"): None,
("projectnumber", "Project Number"): None,
("vessel", "Vessel"): None,
("vesselcontractor", "Vessel Contractor"): None,
("wellname", "Well Name"): None,
Expand All @@ -205,6 +208,12 @@ def get_campaign(self, campaign_id):
("maindataprovider", "Main Data Provider"): None,
("startdate", "Start Date"): None,
("enddate", "End Date"): None,
("geopositionid", "GeoTrack Position ID"): None,
("geolocation", "GeoTrack Location"): None,
("geotitle", "GeoTrack Title"): None,
("hstimeseriesid", "Hs Timeseries ID"): None,
("tptimeseriesid", "Tp Timeseries ID"): None,
("wdtimeseriesid", "Wd Timeseries ID"): None,
}

# change to v1.1 when available
Expand Down Expand Up @@ -431,6 +440,9 @@ def get_swimops_campaign(self, campaign_id):

response = self._get_payload(self._url(f"/{campaign_id}/Swimops"))

if not response:
return {}

response_out = _dict_rename(response[0], response_map)
return response_out

Expand Down

0 comments on commit f057f36

Please sign in to comment.