Skip to content

Commit

Permalink
fix: fix statistics for RFCs to show properly. (#8139)
Browse files Browse the repository at this point in the history
  • Loading branch information
kivinen authored Nov 3, 2024
1 parent deb58a1 commit 19d80ff
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions ietf/stats/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,14 +596,17 @@ def build_document_stats_url(stats_type_override=Ellipsis, get_overrides=None):

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

person_filters = Q(documentauthor__document__type="draft")

# filter persons
rfc_state = State.objects.get(type="rfc", slug="published")
if document_type == "rfc":
person_filters = Q(documentauthor__document__type="rfc")
person_filters &= Q(documentauthor__document__states=rfc_state)
elif document_type == "draft":
person_filters = Q(documentauthor__document__type="draft")
person_filters &= ~Q(documentauthor__document__states=rfc_state)
else:
person_filters = Q(documentauthor__document__type="rfc")
person_filters |= Q(documentauthor__document__type="draft")

doc_years = defaultdict(set)

Expand All @@ -625,8 +628,8 @@ def build_document_stats_url(stats_type_override=Ellipsis, get_overrides=None):
).values_list("source", flat=True)[:1]
)
)
.values_list("draft", "time")
.order_by("draft")
.values_list("doc", "time")
.order_by("doc")
)

for doc_id, time in rfcevent_qs.iterator():
Expand Down Expand Up @@ -663,9 +666,11 @@ def build_document_stats_url(stats_type_override=Ellipsis, get_overrides=None):
for name, affiliation, doc in name_affiliation_doc_set:
a = aliases.get(affiliation, affiliation)
if a:
for year in doc_years.get(doc):
if years_from <= year <= years_to:
bins[(year, a)].add(name)
years = doc_years.get(doc)
if years:
for year in years:
if years_from <= year <= years_to:
bins[(year, a)].add(name)

add_labeled_top_series_from_bins(chart_data, bins, limit=8)

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

if continent_name:
for year in doc_years.get(doc):
if years_from <= year <= years_to:
bins[(year, continent_name)].add(name)
years = doc_years.get(doc)
if years:
for year in years:
if years_from <= year <= years_to:
bins[(year, continent_name)].add(name)

add_labeled_top_series_from_bins(chart_data, bins, limit=8)

Expand Down

0 comments on commit 19d80ff

Please sign in to comment.