-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix conflicts and merge branch 'feat/add_mypy_type_checking' of githu…
…b.com:Flagsmith/flagsmith into feat/add_mypy_type_checking
- Loading branch information
Showing
27 changed files
with
3,164 additions
and
1,384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
".": "2.156.1" | ||
".": "2.157.1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
api/edge_api/management/commands/ensure_identity_traits_blanks.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
from typing import Any | ||
|
||
from django.core.management import BaseCommand | ||
from structlog import get_logger | ||
from structlog.stdlib import BoundLogger | ||
|
||
from environments.dynamodb import DynamoIdentityWrapper | ||
|
||
identity_wrapper = DynamoIdentityWrapper() | ||
|
||
|
||
LOG_COUNT_EVERY = 100_000 | ||
|
||
|
||
class Command(BaseCommand): | ||
def handle(self, *args: Any, **options: Any) -> None: | ||
total_count = identity_wrapper.table.item_count | ||
scanned_count = 0 | ||
fixed_count = 0 | ||
|
||
log: BoundLogger = get_logger(total_count=total_count) | ||
log.info("started") | ||
|
||
for identity_document in identity_wrapper.query_get_all_items(): | ||
should_write_identity_document = False | ||
|
||
if identity_traits_data := identity_document.get("identity_traits"): | ||
blank_traits = ( | ||
trait_data | ||
for trait_data in identity_traits_data | ||
if "trait_value" not in trait_data | ||
) | ||
for trait_data in blank_traits: | ||
should_write_identity_document = True | ||
trait_data["trait_value"] = "" | ||
|
||
scanned_count += 1 | ||
scanned_percentage = scanned_count / total_count * 100 | ||
|
||
if should_write_identity_document: | ||
identity_wrapper.put_item(identity_document) | ||
fixed_count += 1 | ||
|
||
log.info( | ||
"identity-fixed", | ||
identity_uuid=identity_document["identity_uuid"], | ||
scanned_count=scanned_count, | ||
scanned_percentage=scanned_percentage, | ||
fixed_count=fixed_count, | ||
) | ||
|
||
if not (scanned_count % LOG_COUNT_EVERY): | ||
log.info( | ||
"in-progress", | ||
scanned_count=scanned_count, | ||
scanned_percentage=scanned_percentage, | ||
fixed_count=fixed_count, | ||
) | ||
|
||
log.info( | ||
"finished", | ||
scanned_count=scanned_count, | ||
scanned_percentage=scanned_percentage, | ||
fixed_count=fixed_count, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
api/features/workflows/core/migrations/0012_alter_changerequest_options.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2.17 on 2024-12-16 16:49 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("workflows_core", "0011_add_project_to_change_requests"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name="changerequest", | ||
options={"ordering": ("id",)}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.