-
Notifications
You must be signed in to change notification settings - Fork 25
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
Category count cleanup #5718
Conversation
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"): |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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/
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
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 |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
# 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
Step one of understanding what data we actually need for these