-
Notifications
You must be signed in to change notification settings - Fork 153
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
Add new ExtendedChoiceField
and map ai_is_trustworthy
"Yes"/"No" values to "CD"
#12979
base: main
Are you sure you want to change the base?
Conversation
ExtendedChoiceField
and map ai_is_trustworthy
"Yes"/"No" values to "CD"
<p class="pni-product-smaller-body mb-0">{% trans "Device:" %} <span class="font-italic">{{ device|extended_choice }}</span></p> | ||
<p class="pni-product-smaller-body mb-0">{% trans "App:" %} <span class="font-italic">{{ app|extended_choice }}</span></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.
While not directly related to the field ai_is_untrustworthy
, these have been updated to use the updated template tag mentioned here
@@ -3,6 +3,6 @@ | |||
<div class="signup-requirement d-flex flex-column"> | |||
<h4 class="pni-product-smaller-body-bold">{{ title }}</h4> | |||
<div class="explanation"> | |||
<p class="pni-product-smaller-body mb-0">{{ value | extended_yes_no }}</p> | |||
<p class="pni-product-smaller-body mb-0">{{ value | extended_choice }}</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.
While not directly related to the field ai_is_untrustworthy
, this line has been updated to use the updated template tag mentioned here
def extended_choice(value): | ||
"""Converts key from ExtendedChoiceField/ExtendedYesNoField to human readable string""" | ||
if value == "Good": | ||
return gettext("Good") | ||
if value == "AVG": | ||
return gettext("Average") | ||
if value == "NI": | ||
return gettext("Needs Improvement") | ||
if value == "Bad": | ||
return gettext("Bad") |
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.
Updated this existing tag instead of creating a new one, because almost all of the GeneralProductPage's fields use the template "product_criterion_primary_info.html", which uses this tag, to render its selection.
@@ -15,7 +15,7 @@ <h3 class="tw-mb-8 tw-font-zilla tw-text-2xl tw-leading-7 tw-flex tw-items-cente | |||
</div> | |||
{% else %} | |||
<p class="rating pni-product-smaller-body mb-0"> | |||
{% trans value|extended_yes_no context value|extended_yes_no %} | |||
{% trans value|extended_choice context value|extended_choice %} |
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.
This is the template used to render the "How trustworthy is the AI?" section, as well as every other field that uses the ExtendedYesNoField
/ExtendedChoiceField
.
It has been updated to use the updated template tag mentioned here
import networkapi.wagtailpages.fields | ||
|
||
|
||
def map_yes_no_to_cant_determine(apps, schema_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.
Kudos! Good job on this! 🙌
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.
@danielfmiranda thank you for working on this. Everything looks good to me, I just left a minor suggestion for the ai_help
title. Amazing work! 🚀
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.
@danielfmiranda amzing job! A minor observation I just saw on the ai_helptext
title, it would be nice to standardize the word of "Ai" to "AI" - maybe we can add verbose_name="AI helptext"
🙌
Description
Link to Review App: https://foundation-s-pni-trustw-eoreu3.herokuapp.com/en/privacynotincluded/newspaper-present-man-recent/
This PR introduces a new
ExtendedChoiceField
model, offering users the following selection of options:The
ai_is_untrustworthy
field in theGeneralProductPage
model has been updated to use this new set of choices.Additionally, this PR includes a migration operation that iterates through all
GeneralProductPage
instances whereai_is_untrustworthy
is currently set toYes
orNo
, and updates those values toCan’t Determine (CD)
to align with the new choices.Some front-end templates have also been updated to accommodate for this change to the
ai_is_untrustworthy
field.Screenshots
CMS:
CMS (Choices):
Template:
Methodology Template:
How-to-use Template:
┆Issue is synchronized with this Jira Story