Self hosted FLOSS fitness/workout, nutrition and weight tracker
Start refining the trophy values
Roland Geider4dfa712b91d1
diff --git a/wger/trophies/fixtures/initial_trophies.json b/wger/trophies/fixtures/initial_trophies.jsonindex 1cb61b93c..e3c2d880a 100644--- a/wger/trophies/fixtures/initial_trophies.json+++ b/wger/trophies/fixtures/initial_trophies.json@@ -58,8 +58,8 @@"pk": 4,"fields": {"uuid": "5353989b-adc0-481b-a9bc-64365a9179e8",- "name": "Lifter",- "description": "Lift a cumulative total of 5,000 kg",+ "name": "Elephant lifter",+ "description": "Lift a cumulative total of 5.000 kg","trophy_type": "volume","checker_class": "volume","checker_params": {"kg": 5000},@@ -76,11 +76,11 @@"pk": 5,"fields": {"uuid": "3c53887b-feba-4d73-8022-e446f46395c8",- "name": "Atlas",- "description": "Lift a cumulative total of 100,000 kg",+ "name": "Bus lifter",+ "description": "Lift a cumulative total of 20.000 kg","trophy_type": "volume","checker_class": "volume",- "checker_params": {"kg": 100000},+ "checker_params": {"kg": 20000},"is_hidden": false,"is_progressive": true,"is_active": true,@@ -92,6 +92,96 @@{"model": "trophies.trophy","pk": 6,+ "fields": {+ "uuid": "70ee1605-20b8-4c8d-87a1-3787b9b3939d",+ "name": "Plane lifter",+ "description": "Lift a cumulative total of 50.000 kg",+ "trophy_type": "volume",+ "checker_class": "volume",+ "checker_params": {"kg": 50000},+ "is_hidden": true,+ "is_progressive": true,+ "is_active": true,+ "order": 6,+ "created": "2025-12-19T00:00:00Z",+ "updated": "2025-12-19T00:00:00Z"+ }+ },+ {+ "model": "trophies.trophy",+ "pk": 7,+ "fields": {+ "uuid": "3b4521ee-14bc-4a31-a3d8-e6859e183a35",+ "name": "Blue whale lifter",+ "description": "Lift a cumulative total of 150.000 kg",+ "trophy_type": "volume",+ "checker_class": "volume",+ "checker_params": {"kg": 100000},+ "is_hidden": true,+ "is_progressive": true,+ "is_active": true,+ "order": 7,+ "created": "2025-12-19T00:00:00Z",+ "updated": "2025-12-19T00:00:00Z"+ }+ },+ {+ "model": "trophies.trophy",+ "pk": 8,+ "fields": {+ "uuid": "f0a5fd12-2508-4654-89aa-3d6dbb29c7e3",+ "name": "Space Station lifter",+ "description": "Lift a cumulative total of 450.000 kg",+ "trophy_type": "volume",+ "checker_class": "volume",+ "checker_params": {"kg": 450000},+ "is_hidden": true,+ "is_progressive": true,+ "is_active": true,+ "order": 8,+ "created": "2025-12-19T00:00:00Z",+ "updated": "2025-12-19T00:00:00Z"+ }+ },+ {+ "model": "trophies.trophy",+ "pk": 9,+ "fields": {+ "uuid": "2c770528-3528-4f0a-9d1a-342d96935bdf",+ "name": "Millionaire",+ "description": "Lift a cumulative total of 1.000.000 kg (that's a fully loaded space shuttle!)",+ "trophy_type": "volume",+ "checker_class": "volume",+ "checker_params": {"kg": 1000000},+ "is_hidden": true,+ "is_progressive": true,+ "is_active": true,+ "order": 9,+ "created": "2025-12-19T00:00:00Z",+ "updated": "2025-12-19T00:00:00Z"+ }+ },+ {+ "model": "trophies.trophy",+ "pk": 10,+ "fields": {+ "uuid": "e414c29d-5828-4ca3-83b5-4837a71ed48f",+ "name": "Atlas",+ "description": "Lift a cumulative total of 10.000.000 kg",+ "trophy_type": "volume",+ "checker_class": "volume",+ "checker_params": {"kg": 10000000},+ "is_hidden": true,+ "is_progressive": true,+ "is_active": true,+ "order": 10,+ "created": "2025-12-19T00:00:00Z",+ "updated": "2025-12-19T00:00:00Z"+ }+ },+ {+ "model": "trophies.trophy",+ "pk": 11,"fields": {"uuid": "cc833c0b-1fd9-4cde-baa5-3bff9cd97d0c","name": "Early Bird",@@ -102,14 +192,14 @@"is_hidden": false,"is_progressive": false,"is_active": true,- "order": 6,+ "order": 11,"created": "2025-12-19T00:00:00Z","updated": "2025-12-19T00:00:00Z"}},{"model": "trophies.trophy",- "pk": 7,+ "pk": 12,"fields": {"uuid": "2b00ff1e-69f8-47f0-b8df-976a4127a425","name": "Night Owl",@@ -120,14 +210,14 @@"is_hidden": false,"is_progressive": false,"is_active": true,- "order": 7,+ "order": 12,"created": "2025-12-19T00:00:00Z","updated": "2025-12-19T00:00:00Z"}},{"model": "trophies.trophy",- "pk": 8,+ "pk": 13,"fields": {"uuid": "31a71d9a-bf26-4f18-b82f-afefe6f50df2","name": "New Year, New Me",@@ -135,17 +225,17 @@"trophy_type": "date","checker_class": "date_based","checker_params": {"month": 1, "day": 1},- "is_hidden": false,+ "is_hidden": true,"is_progressive": false,"is_active": true,- "order": 8,+ "order": 13,"created": "2025-12-19T00:00:00Z","updated": "2025-12-19T00:00:00Z"}},{"model": "trophies.trophy",- "pk": 9,+ "pk": 14,"fields": {"uuid": "32bb12da-b25f-4e18-81e4-b695eb65283e","name": "Phoenix",@@ -156,14 +246,14 @@"is_hidden": true,"is_progressive": false,"is_active": true,- "order": 9,+ "order": 14,"created": "2025-12-19T00:00:00Z","updated": "2025-12-19T00:00:00Z"}},{"model": "trophies.trophy",- "pk": 10,+ "pk": 15,"fields": {"uuid": "d4a5dbe7-7e15-4f7c-8560-a19f5f27eb2e","name": "Personal Record",@@ -174,7 +264,7 @@"is_hidden": true,"is_progressive": false,"is_repeatable": true,- "order": 10,+ "order": 15,"created": "2025-12-19T00:00:00Z","updated": "2025-12-19T00:00:00Z"}diff --git a/wger/trophies/migrations/0001_initial.py b/wger/trophies/migrations/0001_initial.pyindex 437630179..157f16909 100644--- a/wger/trophies/migrations/0001_initial.py+++ b/wger/trophies/migrations/0001_initial.py@@ -103,7 +103,7 @@ class Migration(migrations.Migration):('is_repeatable',models.BooleanField(- default=True,+ default=False,help_text='If true, this trophy can be earned multiple times',verbose_name='Repeatable',),diff --git a/wger/trophies/migrations/0002_load_initial_trophies.py b/wger/trophies/migrations/0002_load_initial_trophies.pyindex 0c11d0d1d..b66d89bee 100644--- a/wger/trophies/migrations/0002_load_initial_trophies.py+++ b/wger/trophies/migrations/0002_load_initial_trophies.py@@ -4,6 +4,167 @@ from django.db import migrationsfrom django.db.backends.base.schema import BaseDatabaseSchemaEditorfrom django.db.migrations.state import StateApps+volume_trophy_data = {+ 'trophy_type': 'volume',+ 'checker_class': 'volume',+ 'is_hidden': False,+ 'is_progressive': True,+ 'is_repeatable': False,+}++# Define the initial trophies (same as in load_trophies management command)+trophies_data = [+ {+ 'uuid': '5362e55b-eaf1-4e34-9ef8-661538a3bdd9',+ 'name': 'Beginner',+ 'description': 'Complete your first workout',+ 'trophy_type': 'count',+ 'checker_class': 'count_based',+ 'checker_params': {'count': 1},+ 'is_hidden': False,+ 'is_progressive': False,+ 'order': 1,+ },+ {+ 'uuid': 'b605b6a1-953d-41fb-87c9-a2f88b5f5907',+ 'name': 'Unstoppable',+ 'description': 'Maintain a 30-day workout streak',+ 'trophy_type': 'sequence',+ 'checker_class': 'streak',+ 'checker_params': {'days': 30},+ 'is_hidden': False,+ 'is_progressive': True,+ 'order': 2,+ },+ {+ 'uuid': 'bf60e051-a9a5-4bf5-ac4b-1aa713febca7',+ 'name': 'Weekend Warrior',+ 'description': 'Work out on Saturday and Sunday for 4 consecutive weekends',+ 'trophy_type': 'sequence',+ 'checker_class': 'weekend_warrior',+ 'checker_params': {'weekends': 4},+ 'is_hidden': False,+ 'is_progressive': True,+ 'order': 3,+ },+ {+ **volume_trophy_data,+ 'uuid': '5353989b-adc0-481b-a9bc-64365a9179e8',+ 'name': 'Elephant lifter',+ 'description': 'Lift a cumulative total of 5.000 kg',+ 'checker_params': {'kg': 5_000},+ 'order': 4,+ },+ {+ **volume_trophy_data,+ 'uuid': '3c53887b-feba-4d73-8022-e446f46395c8',+ 'name': 'Bus lifter',+ 'description': 'Lift a cumulative total of 20.000 kg',+ 'checker_params': {'kg': 20_000},+ 'order': 5,+ },+ {+ **volume_trophy_data,+ 'uuid': '70ee1605-20b8-4c8d-87a1-3787b9b3939d',+ 'name': 'Plane lifter',+ 'description': 'Lift a cumulative total of 50.000 kg',+ 'checker_params': {'kg': 50_000},+ 'order': 6,+ },+ {+ **volume_trophy_data,+ 'uuid': '3b4521ee-14bc-4a31-a3d8-e6859e183a35',+ 'name': 'Blue whale lifter',+ 'description': 'Lift a cumulative total of 150.000 kg',+ 'checker_params': {'kg': 150_000},+ 'order': 7,+ 'is_hidden':True,+ },+ {+ **volume_trophy_data,+ 'uuid': 'f0a5fd12-2508-4654-89aa-3d6dbb29c7e3',+ 'name': 'Space Station lifter',+ 'description': 'Lift a cumulative total of 450.000 kg',+ 'checker_params': {'kg': 450_000},+ 'order': 8,+ 'is_hidden':True,+ },+ {+ **volume_trophy_data,+ 'uuid': '2c770528-3528-4f0a-9d1a-342d96935bdf',+ 'name': 'Millionaire',+ 'description': 'Lift a cumulative total of 1.000.000 kg',+ 'checker_params': {'kg': 1_000_000},+ 'order': 9,+ 'is_hidden':True,+ },+ {+ **volume_trophy_data,+ 'uuid': 'e414c29d-5828-4ca3-83b5-4837a71ed48f',+ 'name': 'Atlas',+ 'description': 'Lift a cumulative total of 10.000.000 kg',+ 'checker_params': {'kg': 10_000_000},+ 'order': 10,+ 'is_hidden':True,+ },+ {+ 'uuid': 'cc833c0b-1fd9-4cde-baa5-3bff9cd97d0c',+ 'name': 'Early Bird',+ 'description': 'Complete a workout before 6:00 AM',+ 'trophy_type': 'time',+ 'checker_class': 'time_based',+ 'checker_params': {'before': '06:00'},+ 'is_hidden': False,+ 'is_progressive': False,+ 'order': 11,+ },+ {+ 'uuid': '2b00ff1e-69f8-47f0-b8df-976a4127a425',+ 'name': 'Night Owl',+ 'description': 'Complete a workout after 9:00 PM',+ 'trophy_type': 'time',+ 'checker_class': 'time_based',+ 'checker_params': {'after': '21:00'},+ 'is_hidden': False,+ 'is_progressive': False,+ 'order': 12,+ },+ {+ 'uuid': '31a71d9a-bf26-4f18-b82f-afefe6f50df2',+ 'name': 'New Year, New Me',+ 'description': 'Work out on January 1st',+ 'trophy_type': 'date',+ 'checker_class': 'date_based',+ 'checker_params': {'month': 1, 'day': 1},+ 'is_hidden': True,+ 'is_progressive': False,+ 'order': 13,+ },+ {+ 'uuid': '32bb12da-b25f-4e18-81e4-b695eb65283e',+ 'name': 'Phoenix',+ 'description': 'Return to training after being inactive for 30 days',+ 'trophy_type': 'other',+ 'checker_class': 'inactivity_return',+ 'checker_params': {'inactive_days': 30},+ 'is_hidden': True,+ 'is_progressive': False,+ 'order': 14,+ },+ {+ 'uuid': 'd4a5dbe7-7e15-4f7c-8560-a19f5f27eb2e',+ 'name': 'Personal Record',+ 'description': 'Achieve a new Personal Record on any exercise',+ 'trophy_type': 'pr',+ 'checker_class': 'personal_record',+ 'checker_params': {},+ 'is_hidden': True,+ 'is_progressive': False,+ 'is_repeatable': True,+ 'order': 15,+ },+]+def load_initial_trophies(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor):"""@@ -14,121 +175,6 @@ def load_initial_trophies(apps: StateApps, schema_editor: BaseDatabaseSchemaEdit"""Trophy = apps.get_model('trophies', 'Trophy')- # Define the initial trophies (same as in load_trophies management command)- trophies_data = [- {- 'uuid': '5362e55b-eaf1-4e34-9ef8-661538a3bdd9',- 'name': 'Beginner',- 'description': 'Complete your first workout',- 'trophy_type': 'count',- 'checker_class': 'count_based',- 'checker_params': {'count': 1},- 'is_hidden': False,- 'is_progressive': False,- 'order': 1,- },- {- 'uuid': 'b605b6a1-953d-41fb-87c9-a2f88b5f5907',- 'name': 'Unstoppable',- 'description': 'Maintain a 30-day workout streak',- 'trophy_type': 'sequence',- 'checker_class': 'streak',- 'checker_params': {'days': 30},- 'is_hidden': False,- 'is_progressive': True,- 'order': 2,- },- {- 'uuid': 'bf60e051-a9a5-4bf5-ac4b-1aa713febca7',- 'name': 'Weekend Warrior',- 'description': 'Work out on Saturday and Sunday for 4 consecutive weekends',- 'trophy_type': 'sequence',- 'checker_class': 'weekend_warrior',- 'checker_params': {'weekends': 4},- 'is_hidden': False,- 'is_progressive': True,- 'order': 3,- },- {- 'uuid': '5353989b-adc0-481b-a9bc-64365a9179e8',- 'name': 'Lifter',- 'description': 'Lift a cumulative total of 5,000 kg',- 'trophy_type': 'volume',- 'checker_class': 'volume',- 'checker_params': {'kg': 5000},- 'is_hidden': False,- 'is_progressive': True,- 'order': 4,- },- {- 'uuid': '3c53887b-feba-4d73-8022-e446f46395c8',- 'name': 'Atlas',- 'description': 'Lift a cumulative total of 100,000 kg',- 'trophy_type': 'volume',- 'checker_class': 'volume',- 'checker_params': {'kg': 100000},- 'is_hidden': False,- 'is_progressive': True,- 'order': 5,- },- {- 'uuid': 'cc833c0b-1fd9-4cde-baa5-3bff9cd97d0c',- 'name': 'Early Bird',- 'description': 'Complete a workout before 6:00 AM',- 'trophy_type': 'time',- 'checker_class': 'time_based',- 'checker_params': {'before': '06:00'},- 'is_hidden': False,- 'is_progressive': False,- 'order': 6,- },- {- 'uuid': '2b00ff1e-69f8-47f0-b8df-976a4127a425',- 'name': 'Night Owl',- 'description': 'Complete a workout after 9:00 PM',- 'trophy_type': 'time',- 'checker_class': 'time_based',- 'checker_params': {'after': '21:00'},- 'is_hidden': False,- 'is_progressive': False,- 'order': 7,- },- {- 'uuid': '31a71d9a-bf26-4f18-b82f-afefe6f50df2',- 'name': 'New Year, New Me',- 'description': 'Work out on January 1st',- 'trophy_type': 'date',- 'checker_class': 'date_based',- 'checker_params': {'month': 1, 'day': 1},- 'is_hidden': False,- 'is_progressive': False,- 'order': 8,- },- {- 'uuid': '32bb12da-b25f-4e18-81e4-b695eb65283e',- 'name': 'Phoenix',- 'description': 'Return to training after being inactive for 30 days',- 'trophy_type': 'other',- 'checker_class': 'inactivity_return',- 'checker_params': {'inactive_days': 30},- 'is_hidden': True,- 'is_progressive': False,- 'order': 9,- },- {- 'uuid': 'd4a5dbe7-7e15-4f7c-8560-a19f5f27eb2e',- 'name': 'Personal Record',- 'description': 'Achieve a new Personal Record on any exercise',- 'trophy_type': 'pr',- 'checker_class': 'personal_record',- 'checker_params': {},- 'is_hidden': True,- 'is_progressive': False,- 'is_repeatable': True,- 'order': 9,- },- ]-for trophy_data in trophies_data:Trophy.objects.update_or_create(uuid=trophy_data['uuid'], defaults=trophy_data)@@ -142,18 +188,7 @@ def reverse_load_trophies(apps: StateApps, schema_editor: BaseDatabaseSchemaEdit"""Trophy = apps.get_model('trophies', 'Trophy')- trophy_names = [- 'Beginner',- 'Unstoppable',- 'Weekend Warrior',- 'Lifter',- 'Atlas',- 'Early Bird',- 'Night Owl',- 'New Year, New Me',- 'Phoenix',- 'Personal Record',- ]+ trophy_names = [t['name'] for t in trophies_data]deleted_count = Trophy.objects.filter(name__in=trophy_names).delete()[0]if deleted_count > 0: