Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 11 additions & 1 deletion backend/editor/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,20 @@ def file_cleanup(filepath):
log.warn(f"Taxonomy file {filepath} not found for deletion")


SPLIT_WITH_SLASH = {
"food_ingredients",
"food_categories",
"beauty_categories",
"beauty_labels",
"product_categories",
"product_labels",
}


def taxonomy_path_in_repository(taxonomy_name):
"""Helper function to get the path of a taxonomy in the repository"""
path = taxonomy_name
# hacky for now until we restructure better
if path in ("food_ingredients", "food_categories"):
if path in SPLIT_WITH_SLASH:
path = path.replace("_", "/")
return f"taxonomies/{path}.txt"
4 changes: 4 additions & 0 deletions taxonomy-editor-frontend/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ export const TAXONOMY_NAMES = [
"States",
"Test",
"Vitamins",
"Beauty Categories",
"Beauty Labels",
"Product Categories",
"Product Labels",
];
Loading