@@ -276,39 +276,6 @@ def find_candidates_for_deduplication_unique_id(test, findings):
276276 return existing_by_uid
277277
278278
279- def deduplicate_uid_or_hash_code_old (new_finding ):
280- if new_finding .test .engagement .deduplication_on_engagement :
281- existing_findings = Finding .objects .filter (
282- (Q (hash_code__isnull = False ) & Q (hash_code = new_finding .hash_code ))
283- # unique_id_from_tool can only apply to the same test_type because it is parser dependent
284- | (Q (unique_id_from_tool__isnull = False ) & Q (unique_id_from_tool = new_finding .unique_id_from_tool ) & Q (test__test_type = new_finding .test .test_type )),
285- test__engagement = new_finding .test .engagement ).exclude (
286- id = new_finding .id ).exclude (
287- duplicate = True ).order_by ("id" )
288- else :
289- # same without "test__engagement=new_finding.test.engagement" condition
290- existing_findings = Finding .objects .filter (
291- (Q (hash_code__isnull = False ) & Q (hash_code = new_finding .hash_code ))
292- | (Q (unique_id_from_tool__isnull = False ) & Q (unique_id_from_tool = new_finding .unique_id_from_tool ) & Q (test__test_type = new_finding .test .test_type )),
293- test__engagement__product = new_finding .test .engagement .product ).exclude (
294- id = new_finding .id ).exclude (
295- duplicate = True ).order_by ("id" )
296- deduplicationLogger .debug ("Found "
297- + str (len (existing_findings )) + " findings with either the same unique_id_from_tool or hash_code" )
298- for find in existing_findings :
299- if is_deduplication_on_engagement_mismatch (new_finding , find ):
300- deduplicationLogger .debug (
301- "deduplication_on_engagement_mismatch, skipping dedupe." )
302- continue
303- try :
304- if are_endpoints_duplicates (new_finding , find ):
305- set_duplicate (new_finding , find )
306- break
307- except Exception as e :
308- deduplicationLogger .debug (str (e ))
309- continue
310-
311-
312279def find_candidates_for_deduplication_uid_or_hash (test , findings ):
313280 base_queryset = build_dedupe_scope_queryset (test )
314281 hash_codes = {f .hash_code for f in findings if getattr (f , "hash_code" , None ) is not None }
0 commit comments