From 76a72d11f9abfdd38af1f2c69bf51296785a9e2d Mon Sep 17 00:00:00 2001 From: Andrew Tavis McAllister Date: Fri, 20 Dec 2024 00:40:53 +0100 Subject: [PATCH] Fix of breadcrumbs, add hydrate org events/groups, populate args --- .../management/commands/populate_db.py | 28 +++++++++++-- docker-compose.yml | 8 +++- .../card/search-result/CardSearchResult.vue | 42 +++++++++++-------- frontend/components/page/PageBreadcrumbs.vue | 7 ++-- frontend/i18n/en-US.json | 1 + frontend/pages/organizations/[id]/events.vue | 8 +--- .../pages/organizations/[id]/groups/index.vue | 3 +- frontend/stores/organization.ts | 5 +++ 8 files changed, 68 insertions(+), 34 deletions(-) diff --git a/backend/backend/management/commands/populate_db.py b/backend/backend/management/commands/populate_db.py index f4649a2b8..0aad213b5 100644 --- a/backend/backend/management/commands/populate_db.py +++ b/backend/backend/management/commands/populate_db.py @@ -33,12 +33,16 @@ def add_arguments(self, parser: ArgumentParser) -> None: parser.add_argument("--orgs-per-user", type=int, default=1) parser.add_argument("--groups-per-org", type=int, default=1) parser.add_argument("--events-per-org", type=int, default=1) + parser.add_argument("--resources-per-entity", type=int, default=1) + parser.add_argument("--faq-entries-per-entity", type=int, default=1) def handle(self, *args: str, **options: Unpack[Options]) -> None: num_users = options["users"] num_orgs_per_user = options["orgs_per_user"] num_groups_per_org = options["groups_per_org"] num_events_per_org = options["events_per_org"] + num_resources_per_entity = options["resources_per_entity"] + num_faq_entries_per_entity = options["faq_entries_per_entity"] # Clear all tables before creating new data. UserModel.objects.exclude(username="admin").delete() @@ -77,7 +81,7 @@ def handle(self, *args: str, **options: Unpack[Options]) -> None: created_by=user, ) - org_texts = OrganizationTextFactory(iso="wt", primary=True) + org_texts = OrganizationTextFactory(iso="en", primary=True) user_org = OrganizationFactory( created_by=user, @@ -100,12 +104,28 @@ def handle(self, *args: str, **options: Unpack[Options]) -> None: name=f"{user_topic.name} Group", ) + num_orgs = num_users * num_orgs_per_user + num_groups = num_users * num_orgs_per_user * num_groups_per_org + num_events = num_users * num_orgs_per_user * num_events_per_org + num_resources = num_users * ( + num_orgs_per_user + + num_orgs_per_user * num_events_per_org * num_resources_per_entity + + num_orgs_per_user * num_groups_per_org * num_resources_per_entity + ) + num_faq_entries = num_users * ( + num_orgs_per_user + + num_orgs_per_user * num_events_per_org * num_faq_entries_per_entity + + num_orgs_per_user * num_groups_per_org * num_faq_entries_per_entity + ) + self.stdout.write( self.style.ERROR( f"Number of users created: {num_users}\n" - f"Number of organizations created: {num_users * num_orgs_per_user}\n" - f"Number of groups created: {num_users * num_orgs_per_user * num_groups_per_org}\n" - f"Number of events created: {num_users * num_orgs_per_user * num_events_per_org}\n" + f"Number of organizations created: {num_orgs}\n" + f"Number of groups created: {num_groups}\n" + f"Number of events created: {num_events}\n" + f"Number of resources created: {num_resources}\n" + f"Number of FAQ entries created: {num_faq_entries}\n" ) ) diff --git a/docker-compose.yml b/docker-compose.yml index 9873891e0..2eb52c730 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,13 @@ services: python manage.py loaddata fixtures/superuser.json && python manage.py loaddata fixtures/status_types.json && python manage.py loaddata fixtures/topics.json && - python manage.py populate_db --users 10 --orgs-per-user 1 --groups-per-org 1 --events-per-org 1 && + python manage.py populate_db \ + --users 10 \ + --orgs-per-user 1 \ + --groups-per-org 1 \ + --events-per-org 1 \ + --resources-per-entity 1 \ + --faq-entries-per-entity 1 && python manage.py runserver 0.0.0.0:${BACKEND_PORT}" ports: - "${BACKEND_PORT}:${BACKEND_PORT}" diff --git a/frontend/components/card/search-result/CardSearchResult.vue b/frontend/components/card/search-result/CardSearchResult.vue index f158e004c..06f690996 100644 --- a/frontend/components/card/search-result/CardSearchResult.vue +++ b/frontend/components/card/search-result/CardSearchResult.vue @@ -34,9 +34,9 @@ }" :src="imageUrl" :alt=" - $t('components.card_search_result.organization_img_alt_text') + + $t('components.card_search_result.group_img_alt_text') + ' ' + - group.organization.name + group.name " />
- + /> -->