feat: enhance project data handling with new Jinja filters and update UI labels for clarity

This commit is contained in:
2026-02-25 21:41:51 +00:00
parent 291fa8e862
commit bd3d937a82
4 changed files with 59 additions and 11 deletions

View File

@@ -2851,17 +2851,20 @@ async def upload_all_project_data(
Determine the grouping key for a file path.
Files inside Auto_####/Auto_Leq/ or Auto_####/Auto_Lp_01/ are collapsed
up to their Auto_#### parent so they all land in the same session.
Only folder components are examined (not the filename, which is parts[-1]).
"""
# Find the deepest Auto_#### component (case-insensitive)
# Only look at folder components — exclude the filename (last part)
folder_parts = parts[:-1]
auto_idx = None
for i, p in enumerate(parts):
if p.lower().startswith("auto_") and not p.lower().startswith("auto_leq") and not p.lower().startswith("auto_lp"):
for i, p in enumerate(folder_parts):
p_lower = p.lower()
if p_lower.startswith("auto_") and not p_lower.startswith("auto_leq") and not p_lower.startswith("auto_lp"):
auto_idx = i
if auto_idx is not None:
# Group key = everything up to and including Auto_####
return "/".join(parts[:auto_idx + 1])
return "/".join(folder_parts[:auto_idx + 1])
# Fallback: use the immediate parent folder
return "/".join(parts[:-1]) if len(parts) > 1 else ""
return "/".join(folder_parts) if folder_parts else ""
# --- Group files by session key ---
groups: dict[str, list[tuple[str, bytes]]] = defaultdict(list)