Template mapping and detect issue fixed
This commit is contained in:
21
regenerate_fingerprints.py
Normal file
21
regenerate_fingerprints.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import sys
|
||||
import os
|
||||
sys.path.append(os.path.join(os.getcwd(), 'docengine'))
|
||||
|
||||
from app.core.database import SessionLocal
|
||||
from app.models.template import DocumentFormat
|
||||
from app.services.fingerprint_service import FingerprintService
|
||||
|
||||
db = SessionLocal()
|
||||
templates = db.query(DocumentFormat).filter(DocumentFormat.is_active == True).all()
|
||||
|
||||
fp_service = FingerprintService(db)
|
||||
count = 0
|
||||
for t in templates:
|
||||
# Refresh the relations
|
||||
db.refresh(t)
|
||||
fp_service.generate_fingerprint(t)
|
||||
count += 1
|
||||
|
||||
db.commit()
|
||||
print(f"Regenerated fingerprints for {count} active templates.")
|
||||
Reference in New Issue
Block a user