Skip to content

Commit 65d4c99

Browse files
authored
feat: use related docs pages count when no page count (ietf-tools#3686)
1 parent 457bb54 commit 65d4c99

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

ietf/doc/utils_search.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,17 @@ def fill_in_document_table_attributes(docs, have_telechat_date=False):
144144
l.append(rel_rfc_aliases[rel.source_id])
145145
l.sort()
146146

147+
def augment_docs_with_related_docs_info(docs):
148+
"""Augment all documents with related documents information.
149+
At first, it handles only conflict review document page count to mirror the original document page count."""
147150

151+
for d in docs:
152+
if d.type_id == 'conflrev':
153+
if len(d.related_that_doc('conflrev')) != 1:
154+
continue
155+
originalDoc = d.related_that_doc('conflrev')[0].document
156+
d.pages = originalDoc.pages
157+
148158
def prepare_document_table(request, docs, query=None, max_results=200):
149159
"""Take a queryset of documents and a QueryDict with sorting info
150160
and return list of documents with attributes filled in for
@@ -164,6 +174,7 @@ def prepare_document_table(request, docs, query=None, max_results=200):
164174

165175
fill_in_document_table_attributes(docs)
166176
augment_docs_and_user_with_user_info(docs, request.user)
177+
augment_docs_with_related_docs_info(docs)
167178

168179
meta = {}
169180

0 commit comments

Comments
 (0)