From 5f42e19bcdecb86ba20e535e0d271f4ed9edb8b1 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Sun, 28 Mar 2021 16:17:01 +1100 Subject: [PATCH] use kfid instead of kfname for consistency, and now we have 2 loops of kfids, then keep the count explicit (kfid.count) rather than implicity loop.index --- templates/dups.html | 46 ++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/templates/dups.html b/templates/dups.html index 73d57e0..4bbf8c4 100644 --- a/templates/dups.html +++ b/templates/dups.html @@ -49,7 +49,7 @@ $('[id^=kf' + row + '-f]').attr('class', 'alert alert-danger sm-txt py-1') $('[id^=kf' + row + '-f]').attr('class', 'alert alert-danger sm-txt py-1') $('#kf'+row+'-f'+which).attr('class', 'alert alert-' + al + ' py-1') - $('#kfname-'+row).val( F[row.toString()+which.toString()] ) + $('#kfid-'+row).val( F[row.toString()+which.toString()] ) } function KeepDir(row, which) { @@ -67,9 +67,12 @@ {% set pref=namespace(have="") %} {% set count=namespace( del=0, keep=0 ) %} {% set all_count=namespace( d_files=0, k_files=0, manual=0 ) %} + {% set kfid=namespace( count=0 ) %} {# 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 kfid.count = kfid.count+1 %} + + {% set count.keep = count.keep+1 %} {% set count.del = count.del + DD.ip_to_sp_dups_del[h]|length %} {% endfor %} @@ -88,7 +91,9 @@ {% if DD.preferred_file[dup.h] %} {% set pref.have = "True" %} {% if DD.preferred_file[dup.h] == dup.id %} - + {% set kfid.count = kfid.count+1 %} + + {% set count.keep = count.keep + 1 %} {% else %} {% set count.del = count.del + (dups|length-1) %} @@ -101,21 +106,21 @@ {% if page.cnt <= pagesize %} {% if loop.index == 1 %}
+ {% set kfid.count = kfid.count+1 %} + + {% endif %} - {{dup.d}}/{{dup.f}} - {% if DD.preferred_file[dup.h] == dup.id %} - {% set pref.have="kf{}-f{}".format(outer_loop,loop.index) %} - {% endif %} - {% if loop.index < dups|length %} - or - {% else %} - - - {% endif %} - + {{dup.d}}/{{dup.f}} + {% if DD.preferred_file[dup.h] == dup.id %} + {% set pref.have="kf{}-f{}".format(outer_loop,loop.index) %} + {% endif %} + {% if loop.index < dups|length %} + or + {% endif %} + {% if loop.index == dups|length %}
{% endif %} @@ -123,7 +128,7 @@ {% endif %} {% endfor %} {% if pref.have == "" %} - + {% set page.cnt = page.cnt + 1 %} {% endif %} {% endfor %} @@ -137,12 +142,11 @@ {% set count=namespace( keep_d=0, keep_f=0 ) %} {% 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_d = count.keep_d + 1 %} {% set count.keep_f = count.keep_f + dup.hashes|wordcount %}