Skip to content

Commit

Permalink
Remove unnecessary else
Browse files Browse the repository at this point in the history
  • Loading branch information
Wambere committed Aug 22, 2024
1 parent f763386 commit c3b1099
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions importer/importer/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,29 +394,29 @@ def save_image(image_source_url):
def get_product_accountability_period(product_id: str) -> int:
product_endpoint = "/".join([fhir_base_url, "Group", product_id])
response = handle_request("GET", "", product_endpoint)
if response[1] == 200:
json_product = json.loads(response[0])
product_characteristics = json_product["characteristic"]
for character in product_characteristics:
if (
character["code"]["coding"][0]["display"]
== "Accountability period (in months)"
):
accountability_period = character["valueQuantity"]["value"]
return accountability_period
logging.error(
"Accountability period was not found in the product characteristics : "
+ product_id
)
return -1
else:
if response[1] != 200:
logging.error(
"Error while attempting to get the accountability period from product : "
+ product_id
)
logging.error(response[0])
return -1

json_product = json.loads(response[0])
product_characteristics = json_product["characteristic"]
for character in product_characteristics:
if (
character["code"]["coding"][0]["display"]
== "Accountability period (in months)"
):
accountability_period = character["valueQuantity"]["value"]
return accountability_period
logging.error(
"Accountability period was not found in the product characteristics : "
+ product_id
)
return -1


def calculate_date(delivery_date: str, product_accountability_period: int) -> str:
delivery_datetime = datetime.strptime(delivery_date, "%Y-%m-%dT%H:%M:%S.%fZ")
Expand Down

0 comments on commit c3b1099

Please sign in to comment.