Skip to content

Commit

Permalink
Stop writing UploadLevelTotals
Browse files Browse the repository at this point in the history
I believe these are completely unused. They were still being created/updated though.
  • Loading branch information
Swatinem committed Sep 2, 2024
1 parent 66ca059 commit 754249a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 101 deletions.
15 changes: 0 additions & 15 deletions database/tests/factories/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,21 +233,6 @@ class Meta:
created_at = datetime.now()


class UploadLevelTotalsFactory(Factory):
class Meta:
model = models.UploadLevelTotals

upload = factory.SubFactory(UploadFactory)
branches = 0
coverage = 0.00
hits = 0
lines = 0
methods = 0
misses = 0
partials = 0
files = 0


class RepositoryFlagFactory(Factory):
class Meta:
model = models.RepositoryFlag
Expand Down
25 changes: 0 additions & 25 deletions services/report/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
ReportDetails,
ReportLevelTotals,
RepositoryFlag,
UploadLevelTotals,
)
from helpers.environment import Environment, get_current_env
from helpers.exceptions import (
Expand Down Expand Up @@ -1095,24 +1094,6 @@ def update_upload_with_processing_result(
upload_obj.state_id = UploadState.PROCESSED.db_id
upload_obj.state = "processed"
upload_obj.order_number = session.id
upload_totals = upload_obj.totals
if upload_totals is None:
upload_totals = UploadLevelTotals(
upload_id=upload_obj.id,
branches=0,
coverage=0,
hits=0,
lines=0,
methods=0,
misses=0,
partials=0,
files=0,
)
db_session.add(upload_totals)
if session.totals is not None:
upload_totals.update_from_totals(
session.totals, precision=precision, rounding=rounding
)
else:
error = processing_result.error
upload_obj.state = "error"
Expand Down Expand Up @@ -1252,12 +1233,6 @@ def save_full_report(
db_session.add(upload)
db_session.flush()
self._attach_flags_to_upload(upload, session.flags if session.flags else [])
if session.totals is not None:
upload_totals = UploadLevelTotals(upload_id=upload.id_)
db_session.add(upload_totals)
upload_totals.update_from_totals(
session.totals, precision=precision, rounding=rounding
)
return res

@sentry_sdk.trace
Expand Down
61 changes: 0 additions & 61 deletions services/tests/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
ReportLevelTotalsFactory,
RepositoryFlagFactory,
UploadFactory,
UploadLevelTotalsFactory,
)
from helpers.exceptions import RepositoryWithoutValidBotError
from services.archive import ArchiveService
Expand Down Expand Up @@ -477,18 +476,6 @@ def test_build_report_from_commit(self, dbsession, mock_storage):

upload = UploadFactory(report=report, order_number=0, upload_type="upload")
dbsession.add(upload)
upload_totals = UploadLevelTotalsFactory(
upload=upload,
files=3,
lines=20,
hits=17,
misses=3,
partials=0,
coverage=85.0,
branches=0,
methods=0,
)
dbsession.add(upload_totals)
dbsession.commit()
dbsession.flush()

Expand Down Expand Up @@ -606,73 +593,25 @@ def test_build_report_from_commit_with_flags(self, dbsession, mock_storage):
report=report, flags=[flag1], order_number=0, upload_type="upload"
)
dbsession.add(upload1)
upload_totals1 = UploadLevelTotalsFactory(
upload=upload1,
files=3,
lines=20,
hits=17,
misses=3,
partials=0,
coverage=85.0,
branches=0,
methods=0,
)
dbsession.add(upload_totals1)
dbsession.commit()

upload2 = UploadFactory(
report=report, flags=[flag1], order_number=1, upload_type="carriedforward"
)
dbsession.add(upload2)
upload_totals2 = UploadLevelTotalsFactory(
upload=upload2,
files=3,
lines=20,
hits=20,
misses=0,
partials=0,
coverage=100.0,
branches=0,
methods=0,
)
dbsession.add(upload_totals2)
dbsession.commit()

upload3 = UploadFactory(
report=report, flags=[flag2], order_number=2, upload_type="carriedforward"
)
dbsession.add(upload3)
upload_totals3 = UploadLevelTotalsFactory(
upload=upload3,
files=3,
lines=20,
hits=20,
misses=0,
partials=0,
coverage=100.0,
branches=0,
methods=0,
)
dbsession.add(upload_totals3)
dbsession.commit()
dbsession.flush()

upload4 = UploadFactory(
report=report, flags=[flag3], order_number=3, upload_type="upload"
)
dbsession.add(upload4)
upload_totals4 = UploadLevelTotalsFactory(
upload=upload4,
files=3,
lines=20,
hits=20,
misses=0,
partials=0,
coverage=100.0,
branches=0,
methods=0,
)
dbsession.add(upload_totals4)
dbsession.commit()
dbsession.flush()

Expand Down

0 comments on commit 754249a

Please sign in to comment.