markup: special email for no matched products

This commit is contained in:
2019-10-30 15:51:14 -07:00
parent ee6794cf2b
commit 0a2412f645
2 changed files with 22 additions and 1 deletions

View File

@ -19,7 +19,7 @@ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'procat2.settings')
django.setup()
from .utils import clean_path, ensure_dir, set_file_perms, WORKDIR
from .email import reply, reply_missing
from .email import reply, reply_missing, reply_no_matches
from .matching import find_marked_products
from .spreadsheet import write_spreadsheet
@ -62,6 +62,11 @@ def process_attachment(from_address, subject, attachment):
# find matches
matches = find_marked_products(pdf_path, workdir, debug=0)
if not matches:
print('no product matches')
reply_no_matches(from_address, subject)
return
print(f'{len(matches)} product matches')
# write spreadsheet