updated lecacy flavors

This commit is contained in:
nvrl committed 2026-02-17 14:21:38 +01:00
1 parent 1725b91661
commit e35c7ead6f
21 files changed
+163 -53

No files matched your search

@@ -43,14 +43,16 @@ class Command(BaseCommand):
return None return None
def handle(self, *args, **options): def handle(self, *args, **options):
# Remove old legacy entries # We no longer delete everything to preserve user data like ratings
Flavor.objects.filter(is_legacy=True).delete() # Instead, we update existing entries.
Flavor.objects.filter(external_id__isnull=True).delete()
energy = Category.objects.get_or_create(name='Energy', defaults={'slug': 'energy'})[0] cat_map = {
hydration = Category.objects.get_or_create(name='Hydration', defaults={'slug': 'hydration'})[0] 'energy': Category.objects.get_or_create(name='Energy', defaults={'slug': 'energy'})[0],
iced_tea = Category.objects.get_or_create(name='Iced Tea', defaults={'slug': 'iced-tea'})[0] 'hydration': Category.objects.get_or_create(name='Hydration', defaults={'slug': 'hydration'})[0],
packs = Category.objects.get_or_create(name='Packs and other', defaults={'slug': 'packs-and-other'})[0] 'iced-tea': Category.objects.get_or_create(name='Iced Tea', defaults={'slug': 'iced-tea'})[0],
'milkshake': Category.objects.get_or_create(name='Milkshake', defaults={'slug': 'milkshake'})[0],
'packs': Category.objects.get_or_create(name='Packs and other', defaults={'slug': 'packs-and-other'})[0],
}
legacy_dir = os.path.join(settings.BASE_DIR, 'legacy') legacy_dir = os.path.join(settings.BASE_DIR, 'legacy')
if not os.path.exists(legacy_dir): if not os.path.exists(legacy_dir):
@@ -61,10 +63,24 @@ class Command(BaseCommand):
return return
json_files = [f for f in os.listdir(legacy_dir) if f.endswith('.json')] json_files = [f for f in os.listdir(legacy_dir) if f.endswith('.json')]
created_count = 0 processed_count = 0
for json_file in json_files: for json_file in json_files:
file_path = os.path.join(legacy_dir, json_file) file_path = os.path.join(legacy_dir, json_file)
file_lower = json_file.lower()
# Determine category from filename
if 'energy' in file_lower:
file_cat = cat_map['energy']
elif 'iced_tea' in file_lower or 'iced-tea' in file_lower:
file_cat = cat_map['iced-tea']
elif 'hydration' in file_lower:
file_cat = cat_map['hydration']
elif 'milkshake' in file_lower:
file_cat = cat_map['milkshake']
else:
file_cat = None
with open(file_path, 'r', encoding='utf-8') as f: with open(file_path, 'r', encoding='utf-8') as f:
data_list = json.load(f) data_list = json.load(f)
@@ -77,23 +93,37 @@ class Command(BaseCommand):
full_desc = f"**Geschmack:** {taste}\n\n{desc}\n\n**Status:** {status_text}" full_desc = f"**Geschmack:** {taste}\n\n{desc}\n\n**Status:** {status_text}"
cat = energy # Determine final category
cat = file_cat
if not cat:
# Fallback to name/desc detection if filename was ambiguous
if "hydration" in name.lower() or "hydration" in desc.lower(): if "hydration" in name.lower() or "hydration" in desc.lower():
cat = hydration cat = cat_map['hydration']
elif "iced tea" in name.lower() or "eistee" in name.lower(): elif "iced tea" in name.lower() or "eistee" in name.lower():
cat = iced_tea cat = cat_map['iced-tea']
elif "milkshake" in name.lower():
cat = cat_map['milkshake']
elif any(k in name.lower() for k in ['bundle', 'set', 'box', 'probe', 'sample', 'taster', 'shaker', 'starter']): elif any(k in name.lower() for k in ['bundle', 'set', 'box', 'probe', 'sample', 'taster', 'shaker', 'starter']):
cat = packs cat = cat_map['packs']
else:
cat = cat_map['energy'] # Ultimate fallback
# Try to find existing flavor by name and category
flavor = Flavor.objects.filter(name=name, category=cat, is_legacy=True).first()
if not flavor:
flavor = Flavor( flavor = Flavor(
name=name, name=name,
category=cat, category=cat,
description=full_desc,
image_url=image_url,
is_available=False,
is_legacy=True, is_legacy=True,
external_id=None external_id=None
) )
self.stdout.write(f"Adding new legacy flavor: {name}")
else:
self.stdout.write(f"Updating legacy flavor: {name}")
flavor.description = full_desc
flavor.is_available = False # Legacy is always unavailable via API
if image_url: if image_url:
# Check if local file exists # Check if local file exists
@@ -103,13 +133,15 @@ class Command(BaseCommand):
if os.path.exists(abs_path): if os.path.exists(abs_path):
file_exists = True file_exists = True
if not file_exists: # Download if missing OR if image_url changed
if not file_exists or flavor.image_url != image_url:
rel_path = self.download_image(image_url, name) rel_path = self.download_image(image_url, name)
if rel_path: if rel_path:
flavor.image = rel_path flavor.image = rel_path
self.stdout.write(f" -> Updated image for: {name}")
flavor.image_url = image_url
flavor.save() flavor.save()
created_count += 1 processed_count += 1
self.stdout.write(f"Added legacy flavor: {name}")
self.stdout.write(self.style.SUCCESS(f"Finished! Created {created_count} legacy flavors.")) self.stdout.write(self.style.SUCCESS(f"Finished! Processed {processed_count} legacy flavors."))
Binary file not shown.

After

Width:  |  Height:  |  Size: 829 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 MiB

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

+1 -2
View File
@@ -347,8 +347,7 @@ const App: React.FC = () => {
borderColor: 'divider', borderColor: 'divider',
bgcolor: (theme) => alpha(theme.palette.background.paper, 0.8), bgcolor: (theme) => alpha(theme.palette.background.paper, 0.8),
backdropFilter: 'blur(12px)', backdropFilter: 'blur(12px)',
color: 'text.primary', color: 'text.primary'
zIndex: (theme) => theme.zIndex.drawer + 1
}} }}
> >
<Toolbar sx={{ minHeight: { xs: 56, sm: 64 }, px: { xs: 1, sm: 4, md: 6 } }}> <Toolbar sx={{ minHeight: { xs: 56, sm: 64 }, px: { xs: 1, sm: 4, md: 6 } }}>
+86
View File
@@ -0,0 +1,86 @@
[
{
"Name": "Dolphin Daiquiri",
"Geschmack": "Erdbeere & Limette",
"Beschreibung": "Ein sommerlicher Klassiker aus der alten Squad-Reihe. Nachempfunden dem Strawberry Daiquiri Cocktail (alkoholfrei). Eine süße Erdbeernote gemischt mit spritziger Limette.",
"Status": "Discontinued",
"Bild_URL": "https://ochdenis.de/media/pages/holy/sorten/holy-energy/daiquiri-dolphin/2f2be0d2eb-1770905032/ne-0032-01.png"
},
{
"Name": "Hitschies Saure Drachenzunge (Blau)",
"Geschmack": "Blaue Himbeere",
"Beschreibung": "Der Klassiker der Kollaboration. Schmeckt wie die blauen sauren Drachenzungen – süß, fruchtig und sauer.",
"Status": "Limited Edition",
"Bild_URL": "https://ochdenis.de/media/pages/holy/sorten/holy-energy/blaue-drachenzungen/65d13502ae-1770905033/ne-0028-01.png"
},
{
"Name": "Hitschies Saure Krakenarme",
"Geschmack": "Orange & Vanille",
"Beschreibung": "Cremige Vanille trifft auf saure Orange. Erinnert stark an die originalen Krakenarme-Süßigkeiten oder Solero-Eis.",
"Status": "Limited Edition",
"Bild_URL": "https://ochdenis.de/media/pages/holy/sorten/holy-energy/krakenarme/33e8c8649b-1770905036/ne-0030-01.png"
},
{
"Name": "Hitschies Saure Spinnenbeine",
"Geschmack": "Cola & Zitrone",
"Beschreibung": "Saurer Cola-Geschmack, angelehnt an die Hitschies Spinnenbeine Fruchtgummis.",
"Status": "Limited Edition",
"Bild_URL": "https://ochdenis.de/media/pages/holy/sorten/holy-energy/spinnenbeine/a1c99108e8-1770905035/ne-0029-01.png"
},
{
"Name": "HOLY Xmas",
"Geschmack": "Pflaume & Zimt",
"Beschreibung": "Eine winterliche Limited Edition, die nach Pflaume und Zimt schmeckt.",
"Status": "Vaulted / Seasonal",
"Bild_URL": "https://ochdenis.de/media/pages/holy/sorten/holy-energy/holy-xmas/f8b4f0e89b-1770905045/ne-0006.png"
},
{
"Name": "Energy Eel",
"Geschmack": "Guarana (Klassischer Energy)",
"Beschreibung": "Der Versuch eines 'klassischen' Energy-Geschmacks, basierend auf Guarana.",
"Status": "Vaulted / Limited",
"Bild_URL": "https://ochdenis.de/media/pages/holy/sorten/holy-energy/energy-eel/f48f40b53f-1770905031/ne-0024-01.png"
},
{
"Name": "Caipirinha Crab",
"Geschmack": "Limette & Rohrzucker",
"Beschreibung": "Ein alkoholfreier Cocktail-Geschmack, inspiriert vom Caipirinha.",
"Status": "Limited Edition",
"Bild_URL": "https://ochdenis.de/media/pages/holy/sorten/holy-energy/caipirinha-crab/966b1dba40-1770905032/ne-0031-01.png"
},
{
"Name": "Mojito Macaw",
"Geschmack": "Limette & Minze",
"Beschreibung": "Erfrischender Mojito-Geschmack mit deutlicher Minznote.",
"Status": "Limited Edition",
"Bild_URL": "https://ochdenis.de/media/pages/holy/sorten/holy-energy/mojito-macaw/ef1c75b720-1770905032/ne-0033-01.png"
},
{
"Name": "BURRsday Bunny",
"Geschmack": "Litschi",
"Beschreibung": "Jubiläums-Sorte (zum 3. oder 4. Geburtstag). Exotischer, süßer Litschi-Geschmack.",
"Status": "Limited Edition",
"Bild_URL": "https://ochdenis.de/media/pages/holy/sorten/holy-energy/burrsday-bunny/2cf46a3a93-1770905037/bunny_20tub.png"
},
{
"Name": "Colada Capybara",
"Geschmack": "Ananas & Kokosnuss",
"Beschreibung": "Piña Colada Style. Cremige Kokosnuss trifft auf fruchtige Ananas.",
"Status": "Limited Edition",
"Bild_URL": "https://ochdenis.de/media/pages/holy/sorten/holy-energy/colada-capybara/ec02595c46-1770905037/capybara_20tub.png"
},
{
"Name": "Cotton Candy Caterpillar",
"Geschmack": "Zuckerwatte",
"Beschreibung": "Sehr süßer Zuckerwatte-Geschmack. (Wurde kurz nach Release wegen eines Deklarationsfehlers bzgl. Vegan/Laktose zurückgerufen).",
"Status": "Recalled / Vaulted",
"Bild_URL": "https://ochdenis.de/media/pages/holy/sorten/holy-energy/cotton-candy-caterpillar/dbe0df4759-1770905039/energy_20tub_20caterpillar.png"
},
{
"Name": "Kola Koala",
"Geschmack": "Cola",
"Beschreibung": "Klassischer Cola-Geschmack, oft Teil des Adventskalenders.",
"Status": "Limited Edition",
"Bild_URL": "https://www.picclickimg.com/bBkAAeSw~hhphERE/Holy-Energy-Koala-Kola-Einzelprobe-selbst-abgef%C3%BCllt.webp"
}
]
-23
View File
@@ -1,23 +0,0 @@
[
{
"Name": "Hitschies Saure Drachenzunge (Blau)",
"Geschmack": "Blaue Himbeere",
"Beschreibung": "Der Klassiker der Kollaboration. Schmeckt wie die blauen sauren Drachenzungen – süß, fruchtig und sauer.",
"Status": "Limited Edition",
"Bild_URL": "https://pbs.twimg.com/media/GRfMeG3b0AAafs-?format=jpg&name=small"
},
{
"Name": "Hitschies Saure Krakenarme",
"Geschmack": "Orange & Vanille",
"Beschreibung": "Cremige Vanille trifft auf saure Orange. Erinnert stark an die originalen Krakenarme-Süßigkeiten oder Solero-Eis.",
"Status": "Limited Edition",
"Bild_URL": "https://scontent-fra5-2.xx.fbcdn.net/v/t39.30808-6/481459525_933111892304551_6012720927773596920_n.jpg?stp=dst-jpg_s640x640_tt6&_nc_cat=106&ccb=1-7&_nc_sid=127cfc&_nc_ohc=Cdh-KooVUtAQ7kNvwG7p0fQ&_nc_oc=Adl2bJS36wdLnSlo6JGyNrshZYY59GMvEx1CKDuvj-K_Cc_fEBP1H-bNuGX1_B9DH8U&_nc_zt=23&_nc_ht=scontent-fra5-2.xx&_nc_gid=70krAfOzN_hAUKL6i9aY_Q&oh=00_Afsk9sfWUdcMSaepQWZufWTlg314EkrwAAIbQbJMcrrGQA&oe=6998B737"
},
{
"Name": "Hitschies Saure Spinnenbeine",
"Geschmack": "Cola & Zitrone",
"Beschreibung": "Saurer Cola-Geschmack, angelehnt an die Hitschies Spinnenbeine Fruchtgummis.",
"Status": "Limited Edition",
"Bild_URL": "https://pbs.twimg.com/media/GRjfH6NWIAAB8lZ?format=jpg&name=small"
}
]
+25
View File
@@ -0,0 +1,25 @@
[
{
"Name": "Double Apple x Green Tea",
"Geschmack": "Apfel x Grüntee (Doppelapfel)",
"Beschreibung": "Schmeckt intensiv nach Doppelapfel (bekannt von Shisha-Tabak) auf Grüntee-Basis.",
"Status": "Limited Edition",
"Bild_URL": "https://ochdenis.de/media/pages/holy/sorten/holy-iced-tea/double-apple-x-green-tea/4c843d9352-1770905057/ni-0004-01.png"
},
{
"Name": "Pineapple x Green Tea",
"Edition": "SpongeBob Edition",
"Geschmack": "Ananas x Grüntee",
"Beschreibung": "Teil der SpongeBob-Kollaboration. Fruchtige Ananas trifft auf herben Grüntee.",
"Status": "Limited Edition",
"Bild_URL": "https://ochdenis.de/media/pages/holy/sorten/holy-iced-tea/pineapple-x-green-tea/e045627974-1770905051/spongebob_20tub.png"
},
{
"Name": "Starfruit x Hibiscus Tea",
"Edition": "Patrick Star Edition",
"Geschmack": "Sternfrucht x Hibiskustee",
"Beschreibung": "Teil der SpongeBob-Kollaboration (Patrick). Exotische Sternfrucht auf Hibiskus-Basis.",
"Status": "Limited Edition",
"Bild_URL": "https://ochdenis.de/media/pages/holy/sorten/holy-iced-tea/starfruit-x-hibiscus-tea/22b053bd70-1770905052/patrick_20tub.png"
}
]
-9
View File
@@ -1,9 +0,0 @@
[
{
"Name": "Dolphin Daiquiri",
"Geschmack": "Erdbeere & Limette",
"Beschreibung": "Ein sommerlicher Klassiker aus der alten Squad-Reihe. Nachempfunden dem Strawberry Daiquiri Cocktail (alkoholfrei). Eine süße Erdbeernote gemischt mit spritziger Limette.",
"Status": "Discontinued",
"Bild_URL": "https://pbs.twimg.com/media/GOq80SWXAAEnLGG?format=jpg&name=large"
}
]