improved duplicate counting, removed concept of sets, and validated counts work via DB selects, and they do

This commit is contained in:
2021-03-27 14:24:27 +11:00
parent c4f36713bf
commit 932d05b8e3

View File

@@ -5,8 +5,7 @@
<input type="hidden" name="fe_msg_id" value="{{fe_msg_id}}"></input>
<h5>
<div class="form-group">
<label for="pagesize">{{DD.overall_dup_sets}} sets/dirs of files
containing {{DD.overall_dup_cnt}} files -- Showing&nbsp;</label>
<label for="pagesize">{{DD.total_dups}} duplicate files ({{DD.uniq_dups}} Unique) -- Showing&nbsp;</label>
<select id="pagesize" class="form form-control" name="pagesize" onChange="ResetPageSize()">
{% for o in "5", "10", "15", "20", "25", "50", "75", "100", "200" %}
<option
@@ -67,7 +66,7 @@
{% set page=namespace(cnt=0) %}
{% set pref=namespace(have="") %}
{% set count=namespace( del=0, keep=0 ) %}
{% set all_count=namespace( d_files=0, k_files=0, sets=0 ) %}
{% set all_count=namespace( d_files=0, k_files=0, manual=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}}">
@@ -76,7 +75,6 @@
{% endfor %}
{% if count.keep %}
{% set auto.str = auto.str + "<li>Keeping {} files in storage path and deleting {} from import path</li>".format(count.keep, count.del) %}
{% set all_count.sets = all_count.sets + count.keep %}
{% set all_count.k_files = all_count.k_files + count.keep %}
{% set all_count.d_files = all_count.d_files + count.del %}
{% endif %}
@@ -97,6 +95,9 @@
{% endif %}
{% else %}
{# okay, show an alert / make it choosable for each of these manually processed dups #}
{% if loop.index == 1 %}
{% set all_count.manual = all_count.manual + 1 %}
{% endif %}
{% if page.cnt <= pagesize %}
{% if loop.index == 1 %}
<div class="col-lg-12 py-2">
@@ -129,7 +130,6 @@
{% if count.keep %}
{% set auto.str = auto.str + "<li>Keeping {} files inside storage path, Deleting {} duplicates files from storage path</li>".format(count.keep, count.del) %}
{% set all_count.sets = all_count.sets + count.keep %}
{% set all_count.k_files = all_count.k_files + count.keep %}
{% set all_count.d_files = all_count.d_files + count.del %}
{% endif %}
@@ -146,37 +146,39 @@
{% endif %}
{% set count.keep_d = count.keep_d + 1 %}
{% set count.keep_f = count.keep_f + dup.hashes|wordcount %}
{% elif page.cnt <= pagesize %}
<div class="col-lg-12 py-2">
<h5 class="col-lg-12 mt-3">Choose path to KEEP (same file names in 2 different directories):</h5>
{{dup.count}} duplicates in:
{% if dup.d1 == "" %}
{% set d1="/" %}
{% else %}
{% set d1=dup.d1 %}
{% endif %}
{% if dup.d2 == "" %}
{% set d2="/" %}
{% else %}
{% set d2=dup.d2 %}
{% endif %}
<alert id="kd{{loop.index}}-d1" style="cursor: pointer;" onClick="KeepDir({{loop.index}}, 1)" class="alert">{{d1}}</alert> or
<alert id="kd{{loop.index}}-d2" style="cursor: pointer;" onClick="KeepDir({{loop.index}}, 2)" class="alert">{{d2}}</alert>
<input id="kdid-{{loop.index}}" type="hidden" name="kdid-{{loop.index}}">
<input name="kdhash-{{loop.index}}" type="hidden" value="{{dup.hashes}}">
<script>
D[{{loop.index}}1]="{{dup.did1}}"
D[{{loop.index}}2]="{{dup.did2}}"
</script>
</div>
{% set page.cnt = page.cnt + 1 %}
{% else %}
{% set all_count.manual = all_count.manual + 1 %}
{% if page.cnt <= pagesize %}
<div class="col-lg-12 py-2">
<h5 class="col-lg-12 mt-3">Choose path to KEEP (same file names in 2 different directories):</h5>
{{dup.count}} duplicates in:
{% if dup.d1 == "" %}
{% set d1="/" %}
{% else %}
{% set d1=dup.d1 %}
{% endif %}
{% if dup.d2 == "" %}
{% set d2="/" %}
{% else %}
{% set d2=dup.d2 %}
{% endif %}
<alert id="kd{{loop.index}}-d1" style="cursor: pointer;" onClick="KeepDir({{loop.index}}, 1)" class="alert">{{d1}}</alert> or
<alert id="kd{{loop.index}}-d2" style="cursor: pointer;" onClick="KeepDir({{loop.index}}, 2)" class="alert">{{d2}}</alert>
<input id="kdid-{{loop.index}}" type="hidden" name="kdid-{{loop.index}}">
<input name="kdhash-{{loop.index}}" type="hidden" value="{{dup.hashes}}">
<script>
D[{{loop.index}}1]="{{dup.did1}}"
D[{{loop.index}}2]="{{dup.did2}}"
</script>
</div>
{% set page.cnt = page.cnt + 1 %}
{% endif %}
{% endif %}
{% endfor %}
{% if count.keep_d %}
<div class="col-lg-12">
{% set auto.str = auto.str + "<li>Keeping {} files in {} paths, Deleting={} file in {} paths</li>".format( count.keep_f, count.keep_d, count.keep_f, count.keep_d) %}
{% set all_count.sets = all_count.sets + count.keep_d %}
{% set all_count.k_files = all_count.k_files + count.keep_f %}
{% set all_count.d_files = all_count.d_files + count.keep_f %}
</div>
@@ -187,7 +189,7 @@
{{auto.str|safe}}
</ul>
Automatically Keeping {{all_count.k_files}} files and deleting {{all_count.d_files}} files<br>
Leaving {{DD.overall_dup_sets-all_count.sets}} manual choices to make (to delete a further {{DD.overall_dup_cnt-all_count.d_files}} files)
Leaving {{all_count.manual}} manual choices to make (to keep {{DD.uniq_dups-all_count.k_files}} files and delete {{DD.total_dups-all_count.d_files}} files)
</alert>
{% endif %}
<div class="col-lg-12"></div>