From 4294dfd7c309634cba5a58c39b4c6d5047de0df3 Mon Sep 17 00:00:00 2001 From: Dhanur Sharma Date: Tue, 24 Dec 2024 09:55:42 +0100 Subject: [PATCH] Added affected curated urls count on url pattern pages --- sde_collections/serializers.py | 11 ++++++++ .../static/js/delta_url_list.js | 25 +++++++++++++++++++ .../sde_collections/delta_urls_list.html | 11 ++++++++ 3 files changed, 47 insertions(+) diff --git a/sde_collections/serializers.py b/sde_collections/serializers.py index 1a4ac099..e74b5892 100644 --- a/sde_collections/serializers.py +++ b/sde_collections/serializers.py @@ -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): @@ -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 @@ -102,6 +107,7 @@ class Meta: "generated_title_id", "match_pattern_type", "delta_urls_count", + "curated_urls_count", "document_type", "document_type_display", "division", @@ -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", @@ -273,6 +283,7 @@ class Meta: "match_pattern_type", "match_pattern_type_display", "delta_urls_count", + "curated_urls_count", ) abstract = True diff --git a/sde_indexing_helper/static/js/delta_url_list.js b/sde_indexing_helper/static/js/delta_url_list.js index e27ed72f..0b9d05c0 100644 --- a/sde_indexing_helper/static/js/delta_url_list.js +++ b/sde_indexing_helper/static/js/delta_url_list.js @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, diff --git a/sde_indexing_helper/templates/sde_collections/delta_urls_list.html b/sde_indexing_helper/templates/sde_collections/delta_urls_list.html index 20bfc6e5..8484494d 100644 --- a/sde_indexing_helper/templates/sde_collections/delta_urls_list.html +++ b/sde_indexing_helper/templates/sde_collections/delta_urls_list.html @@ -231,6 +231,7 @@

Match Pattern Type Reason Affected Delta URLs + Affected Curated URLs Actions ID @@ -263,6 +264,9 @@

Affected Delta URLs + + Affected Curated URLs + Actions @@ -300,6 +304,9 @@

Affected Delta URLs + + Affected Curated URLs + Actions @@ -337,6 +344,9 @@

Affected Delta URLs + + Affected Curated URLs + Actions @@ -372,6 +382,7 @@

Match Pattern Type Division Affected Delta URLs + Affected Curated URLs Actions ID