Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added affected curated urls count on url pattern pages #1169

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions sde_collections/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class DeltaURLSerializer(serializers.ModelSerializer):
generated_title_id = serializers.SerializerMethodField(read_only=True)
match_pattern_type = serializers.SerializerMethodField(read_only=True)
delta_urls_count = serializers.SerializerMethodField(read_only=True)
curated_urls_count = serializers.SerializerMethodField(read_only=True)
tdamm_tag = serializers.SerializerMethodField()

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

def get_curated_urls_count(self, obj):
titlepattern = obj.deltatitlepatterns.last()
return titlepattern.curated_urls.count() if titlepattern else 0

def get_generated_title_id(self, obj):
titlepattern = obj.deltatitlepatterns.last()
return titlepattern.id if titlepattern else None
Expand All @@ -102,6 +107,7 @@ class Meta:
"generated_title_id",
"match_pattern_type",
"delta_urls_count",
"curated_urls_count",
"document_type",
"document_type_display",
"division",
Expand Down Expand Up @@ -261,10 +267,14 @@ def get_tree_root(self, obj):
class BasePatternSerializer(serializers.ModelSerializer):
match_pattern_type_display = serializers.CharField(source="get_match_pattern_type_display", read_only=True)
delta_urls_count = serializers.SerializerMethodField(read_only=True)
curated_urls_count = serializers.SerializerMethodField(read_only=True)

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

def get_curated_urls_count(self, instance):
return instance.curated_urls.count()

class Meta:
fields = (
"id",
Expand All @@ -273,6 +283,7 @@ class Meta:
"match_pattern_type",
"match_pattern_type_display",
"delta_urls_count",
"curated_urls_count",
)
abstract = True

Expand Down
25 changes: 25 additions & 0 deletions sde_indexing_helper/static/js/delta_url_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,11 @@ function initializeDataTable() {
class: "text-center whiteText",
sortable: true,
},
{
data: "curated_urls_count",
class: "text-center whiteText",
sortable: true,
},
{
data: null,
sortable: false,
Expand Down Expand Up @@ -686,6 +691,11 @@ function initializeDataTable() {
class: "text-center whiteText",
sortable: true,
},
{
data: "curated_urls_count",
class: "text-center whiteText",
sortable: true,
},
{
data: null,
sortable: false,
Expand Down Expand Up @@ -766,6 +776,11 @@ function initializeDataTable() {
class: "text-center whiteText",
sortable: true,
},
{
data: "curated_urls_count",
class: "text-center whiteText",
sortable: true,
},
{
data: null,
sortable: false,
Expand Down Expand Up @@ -878,6 +893,11 @@ function initializeDataTable() {
class: "text-center whiteText",
sortable: true,
},
{
data: "curated_urls_count",
class: "text-center whiteText",
sortable: true,
},
{
data: null,
sortable: false,
Expand Down Expand Up @@ -979,6 +999,11 @@ var division_patterns_table = $("#division_patterns_table").DataTable({
class: "text-center whiteText",
sortable: true,
},
{
data: "curated_urls_count",
class: "text-center whiteText",
sortable: true,
},
{
data: null,
sortable: false,
Expand Down
11 changes: 11 additions & 0 deletions sde_indexing_helper/templates/sde_collections/delta_urls_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ <h3 class="whiteText deltaTitle">
<th scope="col" class="text-center col-1"><strong>Match Pattern Type</strong></th>
<th scope="col" class="text-center col-1"><strong>Reason</strong></th>
<th scope="col" class="text-center col-1"><strong>Affected Delta URLs</strong></th>
<th scope="col" class="text-center col-1"><strong>Affected Curated URLs</strong></th>
<th scope="col" class="text-center col-1"><strong>Actions</strong></th>
<th scope="col" class="text-center col-1"><strong>ID</strong></th>
</tr>
Expand Down Expand Up @@ -263,6 +264,9 @@ <h3 class="whiteText deltaTitle">
<th scope="col" class="text-center col-1">
<strong>Affected Delta URLs</strong>
</th>
<th scope="col" class="text-center col-1">
<strong>Affected Curated URLs</strong>
</th>
<th scope="col" class="text-center col-1">
<strong>Actions</strong>
</th>
Expand Down Expand Up @@ -300,6 +304,9 @@ <h3 class="whiteText deltaTitle">
<th scope="col" class="text-center col-1">
<strong>Affected Delta URLs</strong>
</th>
<th scope="col" class="text-center col-1">
<strong>Affected Curated URLs</strong>
</th>
<th scope="col" class="text-center col-1">
<strong>Actions</strong>
</th>
Expand Down Expand Up @@ -337,6 +344,9 @@ <h3 class="whiteText deltaTitle">
<th scope="col" class="text-center col-1">
<strong>Affected Delta URLs</strong>
</th>
<th scope="col" class="text-center col-1">
<strong>Affected Curated URLs</strong>
</th>
<th scope="col" class="text-center col-1">
<strong>Actions</strong>
</th>
Expand Down Expand Up @@ -372,6 +382,7 @@ <h3 class="whiteText deltaTitle">
<th scope="col" class="text-center col-1"><strong>Match Pattern Type</strong></th>
<th scope="col" class="text-center col-1"><strong>Division</strong></th>
<th scope="col" class="text-center col-1"><strong>Affected Delta URLs</strong></th>
<th scope="col" class="text-center col-1"><strong>Affected Curated URLs</strong></th>
<th scope="col" class="text-center col-1"><strong>Actions</strong></th>
<th scope="col" class="text-center col-1"><strong>ID</strong></th>
</tr>
Expand Down
Loading