Skip to content

Commit 4294dfd

Browse files
committed
Added affected curated urls count on url pattern pages
1 parent 7348a76 commit 4294dfd

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

sde_collections/serializers.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class DeltaURLSerializer(serializers.ModelSerializer):
7272
generated_title_id = serializers.SerializerMethodField(read_only=True)
7373
match_pattern_type = serializers.SerializerMethodField(read_only=True)
7474
delta_urls_count = serializers.SerializerMethodField(read_only=True)
75+
curated_urls_count = serializers.SerializerMethodField(read_only=True)
7576
tdamm_tag = serializers.SerializerMethodField()
7677

7778
def get_tdamm_tag(self, obj):
@@ -82,6 +83,10 @@ def get_delta_urls_count(self, obj):
8283
titlepattern = obj.deltatitlepatterns.last()
8384
return titlepattern.delta_urls.count() if titlepattern else 0
8485

86+
def get_curated_urls_count(self, obj):
87+
titlepattern = obj.deltatitlepatterns.last()
88+
return titlepattern.curated_urls.count() if titlepattern else 0
89+
8590
def get_generated_title_id(self, obj):
8691
titlepattern = obj.deltatitlepatterns.last()
8792
return titlepattern.id if titlepattern else None
@@ -102,6 +107,7 @@ class Meta:
102107
"generated_title_id",
103108
"match_pattern_type",
104109
"delta_urls_count",
110+
"curated_urls_count",
105111
"document_type",
106112
"document_type_display",
107113
"division",
@@ -261,10 +267,14 @@ def get_tree_root(self, obj):
261267
class BasePatternSerializer(serializers.ModelSerializer):
262268
match_pattern_type_display = serializers.CharField(source="get_match_pattern_type_display", read_only=True)
263269
delta_urls_count = serializers.SerializerMethodField(read_only=True)
270+
curated_urls_count = serializers.SerializerMethodField(read_only=True)
264271

265272
def get_delta_urls_count(self, instance):
266273
return instance.delta_urls.count()
267274

275+
def get_curated_urls_count(self, instance):
276+
return instance.curated_urls.count()
277+
268278
class Meta:
269279
fields = (
270280
"id",
@@ -273,6 +283,7 @@ class Meta:
273283
"match_pattern_type",
274284
"match_pattern_type_display",
275285
"delta_urls_count",
286+
"curated_urls_count",
276287
)
277288
abstract = True
278289

sde_indexing_helper/static/js/delta_url_list.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,11 @@ function initializeDataTable() {
605605
class: "text-center whiteText",
606606
sortable: true,
607607
},
608+
{
609+
data: "curated_urls_count",
610+
class: "text-center whiteText",
611+
sortable: true,
612+
},
608613
{
609614
data: null,
610615
sortable: false,
@@ -686,6 +691,11 @@ function initializeDataTable() {
686691
class: "text-center whiteText",
687692
sortable: true,
688693
},
694+
{
695+
data: "curated_urls_count",
696+
class: "text-center whiteText",
697+
sortable: true,
698+
},
689699
{
690700
data: null,
691701
sortable: false,
@@ -766,6 +776,11 @@ function initializeDataTable() {
766776
class: "text-center whiteText",
767777
sortable: true,
768778
},
779+
{
780+
data: "curated_urls_count",
781+
class: "text-center whiteText",
782+
sortable: true,
783+
},
769784
{
770785
data: null,
771786
sortable: false,
@@ -878,6 +893,11 @@ function initializeDataTable() {
878893
class: "text-center whiteText",
879894
sortable: true,
880895
},
896+
{
897+
data: "curated_urls_count",
898+
class: "text-center whiteText",
899+
sortable: true,
900+
},
881901
{
882902
data: null,
883903
sortable: false,
@@ -979,6 +999,11 @@ var division_patterns_table = $("#division_patterns_table").DataTable({
979999
class: "text-center whiteText",
9801000
sortable: true,
9811001
},
1002+
{
1003+
data: "curated_urls_count",
1004+
class: "text-center whiteText",
1005+
sortable: true,
1006+
},
9821007
{
9831008
data: null,
9841009
sortable: false,

sde_indexing_helper/templates/sde_collections/delta_urls_list.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ <h3 class="whiteText deltaTitle">
231231
<th scope="col" class="text-center col-1"><strong>Match Pattern Type</strong></th>
232232
<th scope="col" class="text-center col-1"><strong>Reason</strong></th>
233233
<th scope="col" class="text-center col-1"><strong>Affected Delta URLs</strong></th>
234+
<th scope="col" class="text-center col-1"><strong>Affected Curated URLs</strong></th>
234235
<th scope="col" class="text-center col-1"><strong>Actions</strong></th>
235236
<th scope="col" class="text-center col-1"><strong>ID</strong></th>
236237
</tr>
@@ -263,6 +264,9 @@ <h3 class="whiteText deltaTitle">
263264
<th scope="col" class="text-center col-1">
264265
<strong>Affected Delta URLs</strong>
265266
</th>
267+
<th scope="col" class="text-center col-1">
268+
<strong>Affected Curated URLs</strong>
269+
</th>
266270
<th scope="col" class="text-center col-1">
267271
<strong>Actions</strong>
268272
</th>
@@ -300,6 +304,9 @@ <h3 class="whiteText deltaTitle">
300304
<th scope="col" class="text-center col-1">
301305
<strong>Affected Delta URLs</strong>
302306
</th>
307+
<th scope="col" class="text-center col-1">
308+
<strong>Affected Curated URLs</strong>
309+
</th>
303310
<th scope="col" class="text-center col-1">
304311
<strong>Actions</strong>
305312
</th>
@@ -337,6 +344,9 @@ <h3 class="whiteText deltaTitle">
337344
<th scope="col" class="text-center col-1">
338345
<strong>Affected Delta URLs</strong>
339346
</th>
347+
<th scope="col" class="text-center col-1">
348+
<strong>Affected Curated URLs</strong>
349+
</th>
340350
<th scope="col" class="text-center col-1">
341351
<strong>Actions</strong>
342352
</th>
@@ -372,6 +382,7 @@ <h3 class="whiteText deltaTitle">
372382
<th scope="col" class="text-center col-1"><strong>Match Pattern Type</strong></th>
373383
<th scope="col" class="text-center col-1"><strong>Division</strong></th>
374384
<th scope="col" class="text-center col-1"><strong>Affected Delta URLs</strong></th>
385+
<th scope="col" class="text-center col-1"><strong>Affected Curated URLs</strong></th>
375386
<th scope="col" class="text-center col-1"><strong>Actions</strong></th>
376387
<th scope="col" class="text-center col-1"><strong>ID</strong></th>
377388
</tr>

0 commit comments

Comments
 (0)