Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Nov 24, 2024
1 parent 978a401 commit 21809a7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion scripts/gdpr/create_prices_from_gdpr_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@
# DRY_MODE
]

SOURCE_LIST = ["AUCHAN", "CARREFOUR", "ELECLERC", "INTERMARCHE", "PICARD", "LAFOURCHE"]


def gdpr_source_field_cleanup_rules(gdpr_source, op_field, gdpr_field_value):
"""
Rules to help build the price fields
Rules to help build the price fields (date, price...)
"""
# remove any whitespace
gdpr_field_value = gdpr_field_value.strip()
Expand Down Expand Up @@ -84,6 +86,8 @@ def gdpr_source_field_cleanup_rules(gdpr_source, op_field, gdpr_field_value):
gdpr_field_value = datetime.datetime.strptime(
gdpr_field_value, "%d/%m/%Y"
).strftime("%Y-%m-%d")
elif gdpr_source == "LAFOURCHE":
pass

return gdpr_field_value

Expand Down Expand Up @@ -156,6 +160,8 @@ def gdpr_source_filter_rules(op_price_list, gdpr_source=""):
op_price["product_code"] = full_product_code
else:
passes_test = False
elif gdpr_source == "LAFOURCHE":
pass

if passes_test:
op_price_list_filtered.append(op_price)
Expand Down Expand Up @@ -262,6 +268,9 @@ def create_price(price):
for env_param in REQUIRED_ENV_PARAMS:
if not os.environ.get(env_param):
sys.exit(f"Error: missing {env_param} env")
if env_param == "SOURCE":
if os.environ.get(env_param) not in SOURCE_LIST:
sys.exit(f"Error: invalid SOURCE, must be one of {SOURCE_LIST}")
print("All good :)")

# Step 3: transform input into OP format
Expand Down

0 comments on commit 21809a7

Please sign in to comment.