Commit 370a8ac0 authored by Lukáš Lalinský's avatar Lukáš Lalinský

Add a way to restrict imported submissions by IDs

parent 30a7c920
......@@ -107,14 +107,19 @@ def import_submission(conn, submission, index=None):
return fingerprint
def import_queued_submissions(conn, limit=50, index=None):
def import_queued_submissions(conn, limit=50, index=None, ids=None):
"""
Import the given submission into the main fingerprint database
"""
query = schema.submission.select(schema.submission.c.handled == False).limit(limit).order_by(schema.submission.c.id.desc())
query = schema.submission.select(schema.submission.c.handled == False).order_by(schema.submission.c.id.desc())
if ids is not None:
query = query.whhere(schema.submission.c.id.in_(ids))
if limit is not None:
query = query.limit(limit)
count = 0
for submission in conn.execute(query):
import_submission(conn, submission, index=index)
count += 1
logger.debug("Imported %d submissions", count)
return count
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment