~homeworkprod/byceps

018cd4bf3d046da69ccaa6d61c6964ace83e06fb — Jochen Kupperschmidt 1 year, 1 month ago 92e6a36
Rename brand service function `get_brands` to `get_all_brands`

This makes the name consistent with those for other similar service
functions and leaves room for a function that allows for filter
arguments.
M byceps/blueprints/admin/brand/views.py => byceps/blueprints/admin/brand/views.py +1 -1
@@ 37,7 37,7 @@ permission_registry.register_enum(BrandPermission)
@templated
def index():
    """List brands."""
    brands = brand_service.get_brands()
    brands = brand_service.get_all_brands()

    party_count_by_brand_id = party_service.get_party_count_by_brand_id()


M byceps/blueprints/admin/core/views.py => byceps/blueprints/admin/core/views.py +1 -1
@@ 24,7 24,7 @@ permission_registry.register_enum(AdminPermission)

@blueprint.app_context_processor
def inject_template_variables():
    brands = brand_service.get_brands()
    brands = brand_service.get_all_brands()

    def get_brand_for_party(party):
        return brand_service.find_brand(party.brand_id)

M byceps/blueprints/admin/dashboard/views.py => byceps/blueprints/admin/dashboard/views.py +1 -1
@@ 52,7 52,7 @@ def view_global():
    current_sites = site_service.get_current_sites()
    active_parties = party_service.get_active_parties()

    brands = brand_service.get_brands()
    brands = brand_service.get_all_brands()
    party_count = party_service.count_parties()

    orga_count = orga_service.count_orgas()

M byceps/blueprints/admin/party/views.py => byceps/blueprints/admin/party/views.py +1 -1
@@ 48,7 48,7 @@ def index():
        parties, lambda party: not party.archived
    )

    brands = brand_service.get_brands()
    brands = brand_service.get_all_brands()
    brands.sort(key=lambda brand: brand.title)

    days_by_party_id = {

M byceps/blueprints/admin/site/forms.py => byceps/blueprints/admin/site/forms.py +1 -1
@@ 32,7 32,7 @@ class _BaseForm(LocalizedForm):
    storefront_id = SelectField('Storefront-ID', validators=[Optional()])

    def set_brand_choices(self):
        brands = brand_service.get_brands()
        brands = brand_service.get_all_brands()
        brands.sort(key=lambda brand: brand.title)
        self.brand_id.choices = [(brand.id, brand.title) for brand in brands]


M byceps/blueprints/admin/site/views.py => byceps/blueprints/admin/site/views.py +1 -1
@@ 44,7 44,7 @@ def index():
    sites = site_service.get_all_sites()
    sites.sort(key=lambda site: (site.title, site.party_id))

    brands = brand_service.get_brands()
    brands = brand_service.get_all_brands()
    brands.sort(key=lambda brand: brand.title)

    brands_by_id = {brand.id: brand for brand in brands}

M byceps/blueprints/admin/user_badge/views.py => byceps/blueprints/admin/user_badge/views.py +2 -2
@@ 40,7 40,7 @@ def index():
    """List all badges."""
    all_badges = badge_service.get_all_badges()

    brands = brand_service.get_brands()
    brands = brand_service.get_all_brands()
    brands_by_id = {brand.id: brand for brand in brands}

    def _find_brand(brand_id):


@@ 184,7 184,7 @@ def update(badge_id):


def _set_brand_ids_on_form(form):
    brands = brand_service.get_brands()
    brands = brand_service.get_all_brands()
    form.set_brand_choices(brands)



M byceps/services/brand/service.py => byceps/services/brand/service.py +1 -1
@@ 68,7 68,7 @@ def _get_db_brand(brand_id: BrandID) -> DbBrand:
    return DbBrand.query.get(brand_id)


def get_brands() -> List[Brand]:
def get_all_brands() -> List[Brand]:
    """Return all brands, ordered by title."""
    brands = DbBrand.query \
        .order_by(DbBrand.title) \

M byceps/services/metrics/service.py => byceps/services/metrics/service.py +1 -1
@@ 35,7 35,7 @@ def serialize(metrics: Iterator[Metric]) -> Iterator[str]:


def collect_metrics() -> Iterator[Metric]:
    brand_ids = [brand.id for brand in brand_service.get_brands()]
    brand_ids = [brand.id for brand in brand_service.get_all_brands()]

    active_parties = party_service.get_active_parties()
    active_party_ids = [p.id for p in active_parties]