Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(GDPR): Add lafourche.fr as source #576

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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