|
@@ -1,11 +1,10 @@
|
|
|
from __future__ import annotations
|
|
|
|
|
|
import logging
|
|
|
-from datetime import datetime
|
|
|
+from datetime import datetime, timezone
|
|
|
|
|
|
-import pytz
|
|
|
from django.db.models import F
|
|
|
-from django.utils import timezone
|
|
|
+from django.utils import timezone as django_timezone
|
|
|
|
|
|
from sentry import analytics
|
|
|
from sentry.models import (
|
|
@@ -47,7 +46,7 @@ logger = logging.getLogger("sentry")
|
|
|
# Used to determine if we should or not record an analytic data
|
|
|
# for a first event of a project with a minified stack trace
|
|
|
START_DATE_TRACKING_FIRST_EVENT_WITH_MINIFIED_STACK_TRACE_PER_PROJ = datetime(
|
|
|
- 2022, 12, 14, tzinfo=pytz.UTC
|
|
|
+ 2022, 12, 14, tzinfo=timezone.utc
|
|
|
)
|
|
|
|
|
|
|
|
@@ -238,7 +237,7 @@ def record_first_replay(project, **kwargs):
|
|
|
organization_id=project.organization_id,
|
|
|
task=OnboardingTask.SESSION_REPLAY,
|
|
|
status=OnboardingTaskStatus.COMPLETE,
|
|
|
- date_completed=timezone.now(),
|
|
|
+ date_completed=django_timezone.now(),
|
|
|
)
|
|
|
|
|
|
if success:
|
|
@@ -306,7 +305,7 @@ def record_member_joined(organization_id: int, organization_member_id: int, **kw
|
|
|
status=OnboardingTaskStatus.PENDING,
|
|
|
values={
|
|
|
"status": OnboardingTaskStatus.COMPLETE,
|
|
|
- "date_completed": timezone.now(),
|
|
|
+ "date_completed": django_timezone.now(),
|
|
|
"data": {"invited_member_id": organization_member_id},
|
|
|
},
|
|
|
)
|
|
@@ -491,7 +490,7 @@ def record_alert_rule_created(user, project, rule, rule_type, **kwargs):
|
|
|
"status": OnboardingTaskStatus.COMPLETE,
|
|
|
"user_id": user.id if user else None,
|
|
|
"project_id": project.id,
|
|
|
- "date_completed": timezone.now(),
|
|
|
+ "date_completed": django_timezone.now(),
|
|
|
},
|
|
|
)
|
|
|
|
|
@@ -509,7 +508,7 @@ def record_issue_tracker_used(plugin, project, user, **kwargs):
|
|
|
"status": OnboardingTaskStatus.COMPLETE,
|
|
|
"user_id": user.id,
|
|
|
"project_id": project.id,
|
|
|
- "date_completed": timezone.now(),
|
|
|
+ "date_completed": django_timezone.now(),
|
|
|
"data": {"plugin": plugin.slug},
|
|
|
},
|
|
|
)
|
|
@@ -563,7 +562,7 @@ def record_integration_added(
|
|
|
if task.status != OnboardingTaskStatus.COMPLETE:
|
|
|
task.status = OnboardingTaskStatus.COMPLETE
|
|
|
task.user_id = user_id
|
|
|
- task.date_completed = timezone.now()
|
|
|
+ task.date_completed = django_timezone.now()
|
|
|
task.save()
|
|
|
else:
|
|
|
task = OrganizationOnboardingTask.objects.create(
|