Skip to content

Commit 19d80ff

Browse files
authored
fix: fix statistics for RFCs to show properly. (ietf-tools#8139)
1 parent deb58a1 commit 19d80ff

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

ietf/stats/views.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -596,14 +596,17 @@ def build_document_stats_url(stats_type_override=Ellipsis, get_overrides=None):
596596

597597
elif any(stats_type == t[0] for t in possible_yearly_stats_types):
598598

599-
person_filters = Q(documentauthor__document__type="draft")
600-
601599
# filter persons
602600
rfc_state = State.objects.get(type="rfc", slug="published")
603601
if document_type == "rfc":
602+
person_filters = Q(documentauthor__document__type="rfc")
604603
person_filters &= Q(documentauthor__document__states=rfc_state)
605604
elif document_type == "draft":
605+
person_filters = Q(documentauthor__document__type="draft")
606606
person_filters &= ~Q(documentauthor__document__states=rfc_state)
607+
else:
608+
person_filters = Q(documentauthor__document__type="rfc")
609+
person_filters |= Q(documentauthor__document__type="draft")
607610

608611
doc_years = defaultdict(set)
609612

@@ -625,8 +628,8 @@ def build_document_stats_url(stats_type_override=Ellipsis, get_overrides=None):
625628
).values_list("source", flat=True)[:1]
626629
)
627630
)
628-
.values_list("draft", "time")
629-
.order_by("draft")
631+
.values_list("doc", "time")
632+
.order_by("doc")
630633
)
631634

632635
for doc_id, time in rfcevent_qs.iterator():
@@ -663,9 +666,11 @@ def build_document_stats_url(stats_type_override=Ellipsis, get_overrides=None):
663666
for name, affiliation, doc in name_affiliation_doc_set:
664667
a = aliases.get(affiliation, affiliation)
665668
if a:
666-
for year in doc_years.get(doc):
667-
if years_from <= year <= years_to:
668-
bins[(year, a)].add(name)
669+
years = doc_years.get(doc)
670+
if years:
671+
for year in years:
672+
if years_from <= year <= years_to:
673+
bins[(year, a)].add(name)
669674

670675
add_labeled_top_series_from_bins(chart_data, bins, limit=8)
671676

@@ -724,9 +729,11 @@ def build_document_stats_url(stats_type_override=Ellipsis, get_overrides=None):
724729
continent_name = country_to_continent.get(country_name, "")
725730

726731
if continent_name:
727-
for year in doc_years.get(doc):
728-
if years_from <= year <= years_to:
729-
bins[(year, continent_name)].add(name)
732+
years = doc_years.get(doc)
733+
if years:
734+
for year in years:
735+
if years_from <= year <= years_to:
736+
bins[(year, continent_name)].add(name)
730737

731738
add_labeled_top_series_from_bins(chart_data, bins, limit=8)
732739

0 commit comments

Comments
 (0)