-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* #3384 fixed discordance weekly email table heading * #109 condition override blank condition
- Loading branch information
1 parent
0f468ff
commit 5a1937b
Showing
3 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
classification/management/commands/condition_matching_to_override_blank_condition.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,18 @@ | ||
from django.core.management.base import BaseCommand | ||
from classification.models import Classification | ||
from library.guardian_utils import admin_bot | ||
|
||
|
||
class Command(BaseCommand): | ||
|
||
def handle(self, *args, **options): | ||
user = admin_bot() | ||
classifications = Classification.objects.filter( | ||
condition_resolution__isnull=False, | ||
evidence__condition__validation__icontains="error" | ||
) | ||
print(f"Found {classifications.count()} in database") | ||
for classification in classifications: | ||
print(f"Revalidating {classification}") | ||
classification.revalidate(user=user) | ||
self.stdout.write(self.style.SUCCESS("Revalidation completed to override blank condition.")) |
23 changes: 23 additions & 0 deletions
23
classification/migrations/0109_condition_matching_override_blank condition.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,23 @@ | ||
# Generated by Django 4.2.2 on 2023-08-14 23:42 | ||
from django.db import migrations | ||
from manual.operations.manual_operations import ManualOperation | ||
|
||
|
||
def _override_blank_condition(apps): | ||
Classification = apps.get_model("classification", "Classification") | ||
condition_check = Classification.objects.filter( | ||
condition_resolution__isnull=False, | ||
evidence__condition__validation__icontains="error") | ||
return condition_check.exists() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('classification', '0108_discordancereporttriage'), | ||
] | ||
|
||
operations = [ | ||
ManualOperation(task_id=ManualOperation.task_id_manage(["condition_matching_to_override_blank_condition"]), | ||
test=_override_blank_condition) | ||
] |
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