-
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.
issue #1124 - check annotation range lock dupes (warning only for now)
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
variantgrid/deployment_validation/annotation_status_checks.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,27 @@ | ||
from django.db.models import Count | ||
|
||
from annotation.models import AnnotationRangeLock | ||
|
||
|
||
def check_annotation_status() -> dict: | ||
# I am going to make this a warning for a while - before making it an error | ||
ARL_DUPE_ERROR = False | ||
# see https://github.com/SACGF/variantgrid_shariant/issues/177 | ||
arl_qs = AnnotationRangeLock.objects.values('version_id', 'min_variant_id', 'max_variant_id') | ||
arl_qs = arl_qs.annotate(id_count=Count('id')).filter(id_count__gt=1) | ||
arl_message = "Remove duplicate AnnotationRangeLock objects" | ||
has_dupes = arl_qs.exists() | ||
if ARL_DUPE_ERROR: | ||
arl_data = { | ||
"valid": has_dupes, | ||
"fix": arl_message, | ||
} | ||
else: | ||
arl_data = { | ||
"valid": True, # Just a warning | ||
"warning": arl_message + " (this is a just a warning but will become an error in the future)" | ||
} | ||
annotation_status = { | ||
"AnnotationRangeLock duplicates": arl_data, | ||
} | ||
return annotation_status |
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