Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make The "Annet" Category Stricter and Improve Contrast #58

Merged
merged 2 commits into from
Jun 16, 2024
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
4 changes: 1 addition & 3 deletions rezervo/providers/brpsystems/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,7 @@ def rezervo_class_from_brp_class(
subdomain: BrpSubdomain,
brp_class: BrpClass | DetailedBrpClass,
) -> RezervoClass:
category = determine_activity_category(
brp_class.name, brp_class.externalMessage is not None
)
category = determine_activity_category(brp_class.name)
return RezervoClass(
id=str(brp_class.id), # TODO: check if unique across all subdomains
start_time=datetime.datetime.fromisoformat(
Expand Down
22 changes: 13 additions & 9 deletions rezervo/utils/category_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Optional

from pydantic.main import BaseModel


Expand Down Expand Up @@ -32,7 +30,7 @@ class RezervoCategory(RezervoBaseCategory):
),
RezervoCategory(
name="Mosjon",
color="#00B050",
color="#00A050",
keywords=[
"mosjon",
"godt voksen",
Expand All @@ -41,6 +39,10 @@ class RezervoCategory(RezervoBaseCategory):
"senior",
"baby",
"mama",
"familie",
"kids",
"sprek",
"walk",
],
),
RezervoCategory(
Expand Down Expand Up @@ -68,6 +70,7 @@ class RezervoCategory(RezervoBaseCategory):
"ashtanga",
"shape",
"flexibility",
"balance",
],
),
RezervoCategory(
Expand All @@ -77,7 +80,7 @@ class RezervoCategory(RezervoBaseCategory):
),
RezervoCategory(
name="Kondisjon",
color="#6AD3B4",
color="#C040A0",
keywords=[
"kondis",
"step",
Expand Down Expand Up @@ -118,16 +121,17 @@ class RezervoCategory(RezervoBaseCategory):
"bootcamp",
"olympia",
"absolution",
"bodyweight",
"x-fit",
"kettlebell",
"skill athletic",
"sirkel",
],
),
]


def determine_activity_category(
activity_name: str, has_additional_information: Optional[bool] = False
) -> RezervoCategory:
if has_additional_information:
return OTHER_ACTIVITY_CATEGORY
def determine_activity_category(activity_name: str) -> RezervoCategory:
for category in ACTIVITY_CATEGORIES:
for keyword in category.keywords:
if keyword in activity_name.lower():
Expand Down
Loading