Skip to content

Commit

Permalink
add calendar name prefix for lower envs
Browse files Browse the repository at this point in the history
  • Loading branch information
ivancrneto committed May 26, 2024
1 parent 071a9d3 commit 5c5dbfd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion bahea_cal/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import arrow
import attrs

from django.conf import settings
from django.db import transaction

from core.models import Team, Championship, Location, Phase, Round, Match, SoccerEvent
Expand All @@ -39,7 +40,7 @@ def from_parsed(cls, event):
if match.location:
description += f", {match.location.popular_name}"
return cls(
summary=f"[{match.championship.name}] {match.home_team.popular_name} x {match.away_team.popular_name}",
summary=f"{settings.CALENDAR_NAME_PREFIX}[{match.championship.name}] {match.home_team.popular_name} x {match.away_team.popular_name}",
description=description,
start_datetime=arrow.get(match.start_at).to(timezone),
start_timezone=timezone,
Expand Down
2 changes: 1 addition & 1 deletion core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def google_calendar_redirect_view(request):
service = googleapiclient.discovery.build(API_SERVICE_NAME, API_VERSION, credentials=credentials)

if not user.calendar_id:
calendar = {"summary": "BaheaCal", "timeZone": "America/Bahia"}
calendar = {"summary": f"{settings.CALENDAR_NAME_PREFIX}BaheaCal", "timeZone": "America/Bahia"}
created_calendar = service.calendars().insert(body=calendar).execute()
user.calendar_id = created_calendar["id"]
user.save(update_fields=["calendar_id"])
Expand Down
2 changes: 2 additions & 0 deletions webapp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
DEBUG = djsettings.get("DEBUG", False, cast="@bool")
ENVIRONMENT = djsettings.ENVIRONMENT

CALENDAR_NAME_PREFIX = djsettings.get('CALENDAR_NAME_PREFIX', '', cast="@str")


AUTH_USER_MODEL = "users.User"

Expand Down

0 comments on commit 5c5dbfd

Please sign in to comment.