better re-processing OCR for admin
This commit is contained in:
@@ -68,7 +68,7 @@ def create_submission(
|
||||
|
||||
try:
|
||||
with transaction.atomic():
|
||||
# Check if any confidence score is below 50% to auto-request validation
|
||||
# Check if any confidence score is below 80% to auto-request validation
|
||||
auto_request_validation = any(
|
||||
(
|
||||
response_data.ocr_confidence_cost is not None
|
||||
|
||||
@@ -497,20 +497,15 @@ def verify_and_validate_ocr_date_for_submission(file: SubmissionFile):
|
||||
)
|
||||
|
||||
valid_count = 0
|
||||
if r.cost == ocr_data[1]:
|
||||
r.validated_cost = r.cost
|
||||
valid_count += 1
|
||||
for index, field in enumerate(["cost", "cycles", "area"]):
|
||||
value = getattr(r, field, -1)
|
||||
|
||||
if r.cycles == ocr_data[2]:
|
||||
r.validated_cycles = r.cycles
|
||||
valid_count += 1
|
||||
if value == ocr_data[index + 1]:
|
||||
setattr(r, f"validated_{field}", value)
|
||||
valid_count += 1
|
||||
|
||||
if r.area == ocr_data[3]:
|
||||
r.validated_area = r.area
|
||||
valid_count += 1
|
||||
else:
|
||||
setattr(r, field, ocr_data[index + 1])
|
||||
|
||||
if valid_count == 3:
|
||||
r.needs_manual_validation = False
|
||||
|
||||
if valid_count:
|
||||
r.save()
|
||||
r.needs_manual_validation = valid_count != 3
|
||||
r.save()
|
||||
|
||||
Reference in New Issue
Block a user