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

Use a rich term for vocabulary items in the survey group forms #743

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Changelog
The original ``htmllaundry`` package fails with ``lxml`` 5.2.
[ale-rt, maurits]

- Use a rich term for vocabulary items in the survey group forms
[ale-rt]

- CSV download of similar title details.
Ref: scrum-2198

Expand Down
44 changes: 41 additions & 3 deletions src/euphorie/content/surveygroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
log = logging.getLogger(__name__)


class RichTerm(SimpleTerm):
def __init__(
self, value, token=None, title=None, description=None, extra_help=None
):
super().__init__(value, token, title)
self.description = description
self.extra_help = extra_help


class ISurveyGroup(model.Schema, IBasic):
title = schema.TextLine(
title=_("label_title", default="Title"),
Expand Down Expand Up @@ -56,12 +65,41 @@ class ISurveyGroup(model.Schema, IBasic):
title=_("label_survey_evaluation_algorithm", default="Evaluation algorithm"),
vocabulary=SimpleVocabulary(
[
SimpleTerm(
RichTerm(
"kinney",
title=_("algorithm_kinney", default="Standard three criteria"),
description=_(
"This is the recommended evaluation algorithm, "
"based on the Kinney method"
),
extra_help=_(
"help_survey_evaluation_algorithm_standard",
default=(
"This method involves risk assessment "
"by Severity x Exposure x Probability, "
"whereas these have to be understood as follows; "
"Severity of injury linked to hazard - "
"Exposure (Frequency) to the hazard - "
"Probability of the hazard occuring when exposed"
),
),
),
SimpleTerm(
"french", title=_("french", default="Simplified two criteria")
RichTerm(
"french",
title=_("algorithm_french", default="Simplified two criteria"),
description=_(
"This is a simpler evaluation algorithm "
"using only two criteria."
),
extra_help=_(
"help_survey_evaluation_algorithm_simplified",
default=(
"This method involves risk assessment "
"by Severity x Exposure, whereas these have "
"to be understood as follows; Severity of injury linked "
"to hazard - Exposure (Frequency) to the hazard"
),
),
),
]
),
Expand Down
Loading