From 536c1fb6fc0ca5b1312b888e9be4e33b2b310d3f Mon Sep 17 00:00:00 2001 From: Robert Sparks Date: Thu, 14 Sep 2023 16:43:26 -0500 Subject: [PATCH 1/2] fix: missed docalias artifact removal. Better use of became_rfc. --- ietf/doc/models.py | 13 +++++-------- ietf/doc/utils_search.py | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/ietf/doc/models.py b/ietf/doc/models.py index 7d3286b9a..6c4cdc8bd 100644 --- a/ietf/doc/models.py +++ b/ietf/doc/models.py @@ -354,14 +354,11 @@ class DocumentInfo(models.Model): iesg_state_summary = iesg_state.name if iesg_substate: iesg_state_summary = iesg_state_summary + "::"+"::".join(tag.name for tag in iesg_substate) - - if state.slug == "rfc": - rfcs = self.related_that_doc("became_rfc") # should be only one - if len(rfcs) > 0: - rfc = rfcs[0].document - return f"Became RFC {rfc.rfc_number} ({rfc.std_level})" - else: - return "Became RFC" + + rfc = self.became_rfc() + if rfc: + return f"Became RFC {rfc.rfc_number} ({rfc.std_level})" + elif state.slug == "repl": rs = self.related_that("replaces") if rs: diff --git a/ietf/doc/utils_search.py b/ietf/doc/utils_search.py index 1eb409c59..07aa9757d 100644 --- a/ietf/doc/utils_search.py +++ b/ietf/doc/utils_search.py @@ -148,8 +148,8 @@ def fill_in_document_table_attributes(docs, have_telechat_date=False): ) # TODO - this likely reduces to something even simpler rel_rfcs = { - a.document.id: re.sub(r"rfc(\d+)", r"RFC \1", a.name, flags=re.IGNORECASE) - for a in Document.objects.filter( + d.id: re.sub(r"rfc(\d+)", r"RFC \1", d.name, flags=re.IGNORECASE) + for d in Document.objects.filter( type_id="rfc", id__in=[rel.source_id for rel in xed_by] ) } From 4ddf132efb3ea917d969c267829d6e8a4d1f73ab Mon Sep 17 00:00:00 2001 From: Robert Sparks Date: Fri, 15 Sep 2023 09:51:15 -0500 Subject: [PATCH 2/2] fix: remove leftover docalias detritus --- ietf/doc/utils_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ietf/doc/utils_search.py b/ietf/doc/utils_search.py index 07aa9757d..16cc731bd 100644 --- a/ietf/doc/utils_search.py +++ b/ietf/doc/utils_search.py @@ -178,7 +178,7 @@ def augment_docs_with_related_docs_info(docs): if d.type_id == 'conflrev': if len(d.related_that_doc('conflrev')) != 1: continue - originalDoc = d.related_that_doc('conflrev')[0].document + originalDoc = d.related_that_doc('conflrev')[0] d.pages = originalDoc.pages def prepare_document_table(request, docs, query=None, max_results=200):