Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Category count cleanup #5718

Merged
merged 2 commits into from
Nov 29, 2024
Merged

Category count cleanup #5718

merged 2 commits into from
Nov 29, 2024

Conversation

rowanseymour
Copy link
Member

@rowanseymour rowanseymour commented Nov 28, 2024

Step one of understanding what data we actually need for these

def build_context_menu(self, menu):
obj = self.get_object()

if self.has_org_perm("flows.flow_editor"):
menu.add_link(_("Editor"), reverse("flows.flow_editor", args=[obj.uuid]), as_button=True)

if self.has_org_perm("flows.flow_results"):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need to check this perm because this is the perm of this view

result_fields.append(result_field)
context["result_fields"] = result_fields

context["categories"] = flow.get_category_counts()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used - the category counts are fetched via AJAX call to /flow/category_counts/x/

Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (8f298ad) to head (901b7b5).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #5718   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          573       573           
  Lines        25798     25775   -23     
=========================================
- Hits         25798     25775   -23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

result_field = result_field.copy()
result_field["has_categories"] = "true" if len(result_field["categories"]) > 1 else "false"
result_fields.append(result_field)
context["result_fields"] = result_fields
Copy link
Member Author

@rowanseymour rowanseymour Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used tho interesting that this excludes "hidden" (i.e. name starts with _) results. This was a thing we introduced for classifier actions because they have an internal result required by the router. It's not used anywhere else and we've been showing them on result pages anyway because the other places to fetch category data don't exclude them... so not so worried about them.. especially given how we feel about classifiers in 2024.

"""

permission = "flows.flow_editor"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used by the editor since we added path counts a million years ago

Comment on lines +412 to +414
# TODO maybe we shouldn't store All Responses in the first place
if not category_counts or (len(category_counts) == 1 and "All Responses" in category_counts):
continue

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 'All responses' is used by U-Report

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But U-Report isn't using category counts.. right?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible, I will check again

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct we do not rely on these counts

@rowanseymour rowanseymour merged commit 122c85a into main Nov 29, 2024
5 checks passed
@rowanseymour rowanseymour deleted the category_count_cleanup branch November 29, 2024 13:49
@github-actions github-actions bot locked and limited conversation to collaborators Nov 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants