Skip to content

Commit 1f8a57c

Browse files
committed
Use constant from shared
1 parent 3ee1b67 commit 1f8a57c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Diff for: upload/views/bundle_analysis.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from rest_framework.views import APIView
1212
from shared.api_archive.archive import ArchiveService
1313
from shared.bundle_analysis.storage import StoragePaths, get_bucket_name
14-
from shared.events.amplitude import AmplitudeEventPublisher
14+
from shared.events.amplitude import UNKNOWN_USER_OWNERID, AmplitudeEventPublisher
1515
from shared.metrics import Counter, inc_counter
1616

1717
from codecov_auth.authentication.repo_auth import (
@@ -224,7 +224,9 @@ def post(self, request: HttpRequest) -> Response:
224224
AmplitudeEventPublisher().publish(
225225
"Upload Sent",
226226
{
227-
"user_ownerid": commit.author.ownerid if commit.author else -1,
227+
"user_ownerid": commit.author.ownerid
228+
if commit.author
229+
else UNKNOWN_USER_OWNERID,
228230
"ownerid": repo.author.ownerid,
229231
"repoid": repo.repoid,
230232
"commitid": commit.id, # Not commit.commitid, we do not want a commit SHA here!

Diff for: upload/views/test_results.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from rest_framework.response import Response
99
from rest_framework.views import APIView
1010
from shared.api_archive.archive import ArchiveService, MinioEndpoints
11-
from shared.events.amplitude import AmplitudeEventPublisher
11+
from shared.events.amplitude import UNKNOWN_USER_OWNERID, AmplitudeEventPublisher
1212
from shared.metrics import inc_counter
1313

1414
from codecov_auth.authentication.repo_auth import (
@@ -191,7 +191,9 @@ def post(self, request):
191191
AmplitudeEventPublisher().publish(
192192
"Upload Sent",
193193
{
194-
"user_ownerid": commit.author.ownerid if commit.author else -1,
194+
"user_ownerid": commit.author.ownerid
195+
if commit.author
196+
else UNKNOWN_USER_OWNERID,
195197
"ownerid": repo.author.ownerid,
196198
"repoid": repo.repoid,
197199
"commitid": commit.id, # Not commit.commitid, we do not want a commit SHA here!

0 commit comments

Comments
 (0)