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

Add View find-solution-title-duplications #659

Merged
merged 1 commit into from
Oct 25, 2023
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
2 changes: 2 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Changelog
- Updated styles.
- Short report tweaks
Ref: scrum-1295
- Added view `find-solution-title-duplications`
Refs: scrum-1550


15.0.8 (2023-10-24)
Expand Down
9 changes: 9 additions & 0 deletions src/euphorie/content/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -476,4 +476,13 @@
layer="plonetheme.nuplone.skin.interfaces.NuPloneSkin"
/>

<browser:page
name="find-solution-title-duplications"
for="euphorie.content.survey.ISurvey"
class=".survey.FindSolutionTitleDuplications"
template="templates/find-solution-title-duplications.pt"
permission="cmf.ManagePortal"
layer="plonetheme.nuplone.skin.interfaces.NuPloneSkin"
/>

</configure>
15 changes: 15 additions & 0 deletions src/euphorie/content/browser/survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,3 +448,18 @@ def _filename(self):
mapping=dict(title=self.context.title),
)
return f"{translate(filename, context=self.request)}.docx"


class FindSolutionTitleDuplications(BrowserView):
""""""

@property
def measures(self):
brains = api.content.find(
portal_type="euphorie.solution",
path="/".join(self.context.getPhysicalPath()),
)
for brain in brains:
obj = brain.getObject()
if obj.description in obj.action:
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't it be the other way around? assuming that obj.action is the title...

Suggested change
if obj.description in obj.action:
if obj.action in obj.description:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is an oira weirdness. What the ticket calls the title is in the description attribute and what it calls the description is actually the action attribute.

yield obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
xmlns:meta="http://xml.zope.org/namespaces/meta"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:tal="http://xml.zope.org/namespaces/tal"
meta:interpolation="true"
metal:use-macro="context/@@layout/macros/layout"
i18n:domain="nuplone"
>

<metal:title fill-slot="title">Find Measure Title Duplications</metal:title>
<metal:content fill-slot="content">
<article>
<dl>
<tal:measure tal:repeat="measure view/measures">
<dt><a href="${measure/absolute_url}">${measure/description}</a></dt>
<dd>${measure/action}</dd>
</tal:measure>
</dl>
</article>
</metal:content>
</html>
Loading