Skip to content

Commit

Permalink
better code
Browse files Browse the repository at this point in the history
  • Loading branch information
khvn26 committed May 7, 2024
1 parent 6bc20b6 commit 06917c7
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions api/features/features_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,21 @@ def get_overrides_data(
:return: overrides data getter
"""
project = environment.project
match project.enable_dynamo_db, project.edge_v2_identity_overrides_migrated:
case True, True:

if project.enable_dynamo_db:
if project.edge_v2_identity_overrides_migrated:
# If v2 migration is complete, count segment overrides from Core
# and identity overrides from DynamoDB.
return get_edge_overrides_data(environment)
case True, _:
# If v2 migration is not started, in progress, or incomplete,
# only count segment overrides from Core.
# v1 Edge identity overrides are uncountable.
return get_core_overrides_data(
environment,
skip_identity_overrides=True,
)
case _, _:
# For projects still fully on Core, count all overrides from Core.
return get_core_overrides_data(environment)
# If v2 migration is not started, in progress, or incomplete,
# only count segment overrides from Core.
# v1 Edge identity overrides are uncountable.
return get_core_overrides_data(
environment,
skip_identity_overrides=True,
)
# For projects still fully on Core, count all overrides from Core.
return get_core_overrides_data(environment)


def get_core_overrides_data(
Expand Down

0 comments on commit 06917c7

Please sign in to comment.