fix: sync/barcode/memory overhaul + detailed logs + preview + result tracking
- Sync: fix GiteaSync constructor + add push()/pull() methods - Barcode: two-tab layout matching GUI (mapping + special rules) - Memory: spec→specification unification, manual add, confidence/price tracking - Processing: TaskLogHandler captures detailed logs (barcode mapping, unit conversion) - Preview: fullscreen dialog for file preview (image/Excel) in Orders/Tables/Images - Detail: per-file log filtering in file pages - Tasks: result files now per-task, add copy path button - Config: reactive edited state + save_config fix - Dashboard: sync task isolation, log limit 10 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -475,7 +475,8 @@ def upsert_file_relation(input_image: str = None, output_excel: str = None,
|
||||
|
||||
|
||||
def query_file_relations(view: str = None, status: str = None,
|
||||
page: int = 1, page_size: int = 50) -> tuple[list[dict], int]:
|
||||
page: int = 1, page_size: int = 50,
|
||||
sort_by: str = None, sort_order: str = "desc") -> tuple[list[dict], int]:
|
||||
"""Query file relations with optional view filter and pagination.
|
||||
|
||||
view='orders': only rows with result_purchase, sorted by result_purchase
|
||||
@@ -508,6 +509,13 @@ def query_file_relations(view: str = None, status: str = None,
|
||||
|
||||
where = (" WHERE " + " AND ".join(clauses)) if clauses else ""
|
||||
|
||||
# Sort
|
||||
if sort_by and sort_by in ('created_at', 'updated_at', 'input_image', 'output_excel', 'result_purchase', 'status'):
|
||||
sort_col = sort_by
|
||||
else:
|
||||
sort_col = order_by.split()[0] if order_by else 'id'
|
||||
sort_dir = 'DESC' if sort_order.lower() == 'desc' else 'ASC'
|
||||
|
||||
# Count
|
||||
row = conn.execute(
|
||||
f"SELECT COUNT(*) as cnt FROM file_relations{where}", params
|
||||
@@ -518,7 +526,7 @@ def query_file_relations(view: str = None, status: str = None,
|
||||
offset = (page - 1) * page_size
|
||||
params.extend([page_size, offset])
|
||||
rows = conn.execute(
|
||||
f"SELECT * FROM file_relations{where} ORDER BY {order_by} LIMIT ? OFFSET ?",
|
||||
f"SELECT * FROM file_relations{where} ORDER BY {sort_col} {sort_dir} LIMIT ? OFFSET ?",
|
||||
params,
|
||||
).fetchall()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user