-
Notifications
You must be signed in to change notification settings - Fork 9
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
Task: Content Spacing Correction #801
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Couple of minor things: For teams, the responsibility community is in the field primary_community. |
When you added the 'task' argument: res = func(task) |
Tried testing with my local database. First I ran the report, second I ran the fix.. Both with all communities selected. Third I ran the report again, and the report had the same number of instances. So I think the data wasn[t fixed. Did you test it this way? |
@BradHN1 , I have address all the feedbacks. |
Have you tested this with your local database, and when you update the spacing and run the report again, does it show no occurances of the strings being replaced? |
Yes. it doesn't show already replaced content in the report |
return instance.community.name if instance.community else "" | ||
elif instance and hasattr(instance, "primary_community"): | ||
return instance.primary_community.name if instance.primary_community else "" | ||
|
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.
else return "N/A"
in case the model doesn't have a community
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.
fixed
if count > 0: | ||
if is_feature_enabled(instance): | ||
auto_correct_spacing(instance, field_name, field_value) | ||
else: |
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.
no need for the "else"
Have it always append the data for what is being changed, even if the feature is enabled
|
||
|
||
FEATURE_FLAG_KEY = "update-html-format-feature-flag" | ||
PATTERNS = ["<p><br></p>", "<p>.</p>", "<p> </p>"] |
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.
One more pattern to correct: "<br />.
"
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.
Fixed and pushed
elif hasattr(instance, "primary_community") and instance.primary_community in enabled_communities: | ||
return True | ||
else: | ||
return False |
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.
If the model has a "community" or "primary_community" field, but that is not filled, and the feature flag is enabled, it should make the change. I can update the routine as follows:
if hasattr(instance, "community"): if not instance.community or instance.community in enabled_communities: return True elif hasattr(instance, "primary_community"): if not instance.primary_community or instance.primary_community in enabled_communities: return True return False
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.
LGTM
Summary / Highlights
A few deployments ago, we found a way to resolve the inconsistent spacing in our content between the text on the admin portal and how it displays on the community portal. However, there are still many pieces of content in the database that continue to use the old fix (adding double spacing in the richText field on the admin portal). In this PR, a task has been created to generates a report and fix contents in the db that needs fixing.
Testing Steps (Provide details on how your changes can be tested)
Process Content Spacing
as the automatic process.