From 055dd58d347d306aca8d2cdeebce0ec845f33264 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Sun, 21 Mar 2021 17:00:36 +1100 Subject: [PATCH] better formatting for all automatic matches, deal with automatic matching of preferred_paths, put fields in for files in storage and import paths, only display headings/content if it actually exists --- templates/dups.html | 66 ++++++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/templates/dups.html b/templates/dups.html index babcc37..bbffef9 100644 --- a/templates/dups.html +++ b/templates/dups.html @@ -64,39 +64,36 @@
{# pass this through so that the back-end can delete this message when it rm_dups #} + {% set auto=namespace(str="") %} {% set page=namespace(cnt=0) %} {% set pref=namespace(have="") %} {% set count=namespace( del=0, keep=0 ) %} - {% for dups in DD.ip_to_sp_dups_keep %} + {# for each hash in ip_to_sp_dups_*, auto keep the _keep, auto delete the _del, only need hidden input #} + {% for h in DD.ip_to_sp_dups_keep %} + {% set count.keep = count.keep+1 %} - need to do some hidden inputs here to keep these files
+ {% set count.del = count.del + DD.ip_to_sp_dups_del[h]|length %} {% endfor %} - {% for dups in DD.ip_to_sp_dups_del %} - {% set count.del = count.del+1 %} - maybe need to do some hidden inputs here to del these files? (not sure it was needed in del code to triple-check)
- {% endfor %} - {% if count.keep or count.del %} -
- Keeping {{count.keep}} files in storage path and deleting {{count.del}} from import path -
- {% set count.keep=0 %} - {% set count.del=0 %} + {% if count.keep %} + {% set auto.str = auto.str + "
  • Keeping {} files in storage path and deleting {} from import path
  • ".format(count.keep, count.del) %} {% endif %} -
    Choose between these files:
    +
    Choose between these files:
    + {% set count=namespace( del=0, keep=0 ) %} {% for dups in DD.per_file_dups %} {% set outer_loop=loop.index %} {% set pref.have="" %} {% for dup in dups %} + {# for each hash in preferred_file, auto keep it, only need hidden input, dont process further #} {% if DD.preferred_file[dup.h] %} {% set pref.have = "True" %} {% if DD.preferred_file[dup.h] == dup.id %} - {% set count.keep = count.keep + 1 %} {% else %} {% set count.del = count.del + (dups|length-1) %} {% endif %} {% else %} + {# okay, show an alert / make it choosable for each of these manually processed dups #} {% if page.cnt <= pagesize %} {% if loop.index == 1 %}
    @@ -127,36 +124,55 @@ {% endif %} {% endfor %} -
    - Matched preference regexp: Keep={{count.keep}}, Deleting={{count.del}} -
    + {% if count.keep %} + {% set auto.str = auto.str + "
  • Duplicates in storage path matching naming convention: Keep={}, Delete={}
  • ".format(count.keep, count.del) %} + {% endif %} + {% set count=namespace( del=0, keep=0 ) %} {% if page.cnt < pagesize %} -
    Choose path to KEEP (same file names in 2 different directories):
    {% for dup in DD.per_path_dups %} + {% if DD.preferred_path[dup.did1] or DD.preferred_path[dup.did2] %} + + + {% if DD.preferred_path[dup.did1] %} + + {% else %} + + {% endif %} + {% set count.keep = count.keep + 1 %} + {% else %}
    +
    Choose path to KEEP (same file names in 2 different directories):
    {{dup.count}} duplicates in: {{dup.d1}} or {{dup.d2}} - +
    + {% endif %} {% set page.cnt = page.cnt + 1 %} {% if page.cnt == pagesize %} {% break %} {% endif %} {% endfor %} {% endif %} + {% if count.keep %} +
    + {% set auto.str = auto.str + "
  • Keeping={}, Deleting={} paths of duplicates
  • ".format(count.keep, count.keep) %} +
    + {% endif %} + {% if auto.str|length %} + AUTOMATICALLY matched naming conventions resulting in: +
      + {{auto.str|safe}} +
    +
    + {% endif %} +