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
This commit is contained in:
@@ -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 %}
|
||||
<input type="hidden" name="kfhash-{{outer_loop}}" value="{{h}}">
|
||||
{% set kfid.count = kfid.count+1 %}
|
||||
<input type="hidden" name="kfhash-{{kfid.count}}" value="{{h}}">
|
||||
<input type="hidden" name="kfid-{{kfid.count}}" value="{{DD.ip_to_sp_dups_keep[h].id}}">
|
||||
{% 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 %}
|
||||
<input type="hidden" name="kfhash-{{outer_loop}}" value="{{dup.h}}">
|
||||
{% set kfid.count = kfid.count+1 %}
|
||||
<input type="hidden" name="kfhash-{{kfid.count}}" value="{{dup.h}}">
|
||||
<input type="hidden" name="kfid-{{kfid.count}}" value="{{dup.id}}">
|
||||
{% 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 %}
|
||||
<div class="col-lg-12 py-2">
|
||||
{% set kfid.count = kfid.count+1 %}
|
||||
<input type="hidden" name="kfhash-{{kfid.count}}" value="{{dup.h}}">
|
||||
<input type="hidden" id="kfid-{{kfid.count}}" name="kfid-{{kfid.count}}" value="">
|
||||
{% endif %}
|
||||
<alert id="kf{{outer_loop}}-f{{loop.index}}" style="cursor: pointer;" class="alert"
|
||||
onClick="KeepFile({{outer_loop}},{{loop.index}},'success')">{{dup.d}}/{{dup.f}}</alert>
|
||||
{% 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 %}
|
||||
<input type="hidden" name="kfhash-{{outer_loop}}" value="{{dup.h}}">
|
||||
<input type="hidden" id="kfname-{{outer_loop}}" name="kfname-{{outer_loop}}" value="">
|
||||
{% endif %}
|
||||
<script>
|
||||
F[{{outer_loop}}{{loop.index}}]="{{dup.id}}"
|
||||
</script>
|
||||
<alert id="kf{{kfid.count}}-f{{loop.index}}" style="cursor: pointer;" class="alert"
|
||||
onClick="KeepFile({{kfid.count}},{{loop.index}},'success')">{{dup.d}}/{{dup.f}}</alert>
|
||||
{% 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 %}
|
||||
<script>
|
||||
F[{{kfid.count}}{{loop.index}}]="{{dup.id}}"
|
||||
</script>
|
||||
{% if loop.index == dups|length %}
|
||||
</div class="col-lg-12">
|
||||
{% endif %}
|
||||
@@ -123,7 +128,7 @@
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if pref.have == "" %}
|
||||
<script>KeepFile( {{outer_loop}}, 1,'warning' )</script>
|
||||
<script>KeepFile( {{kfid.count}}, 1,'warning' )</script>
|
||||
{% 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] %}
|
||||
<input id="kdid-{{loop.index}}" type="hidden" name="kdid-1">
|
||||
<input name="kdhash-{{loop.index}}" type="hidden" value="{{dup.hashes}}">
|
||||
{% if DD.preferred_path[dup.did1] %}
|
||||
<input type="hidden" name="kdid-{{loop.index}}" value="DD.preferred_path[dup.did1]">
|
||||
<input type="hidden" name="kdid-{{loop.index}}" value="{{dup.did1}}">
|
||||
{% else %}
|
||||
<input type="hidden" name="kdid-{{loop.index}}" value="DD.preferred_path[dup.did2]">
|
||||
<input type="hidden" name="kdid-{{loop.index}}" value="{{dup.did2}}">
|
||||
{% endif %}
|
||||
{% set count.keep_d = count.keep_d + 1 %}
|
||||
{% set count.keep_f = count.keep_f + dup.hashes|wordcount %}
|
||||
|
||||
Reference in New Issue
Block a user