From f057f367b3bd701bf52921a1edb10d572e0cac6d Mon Sep 17 00:00:00 2001 From: Pamela Joslyn <65171656+pamela-joslyn-4ss@users.noreply.github.com> Date: Fri, 22 Nov 2024 15:13:58 +0100 Subject: [PATCH] Map all fields on get_campaign, and fix get_swimops_campaign to return gracefully if no operations --- fourinsight/campaigns/api.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/fourinsight/campaigns/api.py b/fourinsight/campaigns/api.py index 323eb83..9764288 100644 --- a/fourinsight/campaigns/api.py +++ b/fourinsight/campaigns/api.py @@ -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, @@ -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 @@ -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