From de31d90d2983b23db707bcf3417204a0a52e1a4b Mon Sep 17 00:00:00 2001 From: Julien Papon Date: Mon, 29 Jan 2024 16:31:57 +0100 Subject: [PATCH] feat(mdm): use current year instead of 2022 for sfd creation --- geosyspy/services/master_data_management_service.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/geosyspy/services/master_data_management_service.py b/geosyspy/services/master_data_management_service.py index 5fd1597..5a02793 100644 --- a/geosyspy/services/master_data_management_service.py +++ b/geosyspy/services/master_data_management_service.py @@ -4,6 +4,7 @@ from geosyspy.utils.constants import * from geosyspy.utils.helper import Helper from geosyspy.utils.http_client import * +from datetime import datetime class MasterDataManagementService: @@ -26,10 +27,12 @@ def create_season_field_id(self, polygon: str) -> object: A response object. """ + + year = datetime.now().year payload = { "Geometry": polygon, "Crop": {"Id": "CORN"}, - "SowingDate": "2022-01-01", + "SowingDate": f"{year}-01-01", } mdm_url: str = urljoin(self.base_url, GeosysApiEndpoints.MASTER_DATA_MANAGEMENT_ENDPOINT.value+"/seasonfields") return self.http_client.post(mdm_url, payload)