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

Only one results report is generated when SingleReport template is selected #123

Merged
merged 4 commits into from
May 20, 2022

Conversation

xispa
Copy link
Member

@xispa xispa commented May 20, 2022

Description of the issue/feature this PR addresses

This Pull Request fixes a bug introduced with #119 that causes the system to only render (and publish) the report for the first selected sample when a "SingleReport"-like template is used.

Current behavior before PR

System only renders/publishes/emails the first sample when a "SingleReport"-like template is used

Desired behavior after PR is merged

System renders/publishes/emails all samples when a "SingleReport"-like template is used

--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.

Comment on lines +284 to +287
base_path, uids = url.split("?uids=")
path_uids = groups.get(base_path, "")
groups[base_path] = ",".join(filter(None, [path_uids, uids]))
return "?uids=".join(groups.items()[0])
Copy link
Contributor

Choose a reason for hiding this comment

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

Careful about this one. AFAIK the UIDs might also come in as a POST request inside the payload. Better use urlparse for this task (https://six.readthedocs.io/index.html?highlight=urlparse#module-six.moves)

Copy link
Member Author

Choose a reason for hiding this comment

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

The urls from exit_urls are always generated by the get_exit_url_for function here

exit_urls = map(lambda reports: self.get_exit_url_for(
reports, action=action), report_groups)

And get_exit_url_for always returns a GET with uids parameter and the action passed-in as the endpoint:

exit_url = "{}/{}?uids={}".format(exit_url, endpoint,
",".join(report_uids))
return exit_url

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ok, thanks

@ramonski ramonski merged commit d89c77e into 2.x May 20, 2022
@ramonski ramonski deleted the single-report branch May 20, 2022 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants