Skip to content

Commit b249854

Browse files
committed
fixed errors
1 parent a0e4d78 commit b249854

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

functions-python/tasks_executor/src/tasks/licenses/populate_license_rules.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,19 @@ def populate_license_rules_task(dry_run, db_session):
3737
response = requests.get(RULES_JSON_URL, timeout=10)
3838
response.raise_for_status()
3939
rules_json = response.json()
40+
# Type mapping to satisfy the check constraint of Rule.type
41+
TYPE_MAPPING = {
42+
"permissions": "permission",
43+
"conditions": "condition",
44+
"limitations": "limitation",
45+
}
4046

4147
# Combine all rule lists from the three categories
4248
rules_data = []
4349
for rule_type, rule_list in rules_json.items():
50+
normalized_type = TYPE_MAPPING[rule_type]
4451
for rule_data in rule_list:
45-
# Attach the category/type info to each rule
46-
rule_data["type"] = rule_type
52+
rule_data["type"] = normalized_type
4753
rules_data.append(rule_data)
4854

4955
logging.info(

0 commit comments

Comments
 (0)