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

Export consultation results to CSV #42

Merged
merged 11 commits into from
Oct 9, 2020
Merged

Conversation

sauloperez
Copy link
Collaborator

@sauloperez sauloperez commented Oct 5, 2020

This exports the consultation's results following the exact same table format we render on the page that includes membership data.

It adheres to Decidim's exporter's conventions which send an email with a zip containing the CSV file. Note it also allows you to translate the filename 👌 Thanks @verarojman !

📸

Table

Screenshot from 2020-10-06 18-11-36
with unpublished results

Screenshot from 2020-10-06 18-13-53
with published results

Email with 📎

Screenshot from 2020-10-05 18-19-14

CSV file

Screenshot from 2020-10-05 18-19-46

Missing

  • Disable export if the consultation is not closed yet.

This exports it following the exact same table format we render in the
page that includes membership data.

It adheres to Decidim's exporter's conventions which send an email with
a zip containing the CSV file.
@sauloperez sauloperez self-assigned this Oct 5, 2020
@sauloperez sauloperez force-pushed the export-results-to-csv branch from 90db955 to 6ed4c1e Compare October 5, 2020 16:38
@sauloperez sauloperez marked this pull request as ready for review October 6, 2020 16:16
@sauloperez sauloperez force-pushed the export-results-to-csv branch from b881752 to c453152 Compare October 6, 2020 16:47
Copy link
Contributor

@verarojman verarojman left a comment

Choose a reason for hiding this comment

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

Hi @sauloperez, great job! 🌟 I left some suggestions (most of them concerning style) though everything looks good to me (after a painful setup of the environment required to test it 😭).

@sauloperez sauloperez force-pushed the export-results-to-csv branch from c621ad2 to f68e9c6 Compare October 8, 2020 07:14
This way users will have a named in Catalan which will be more user
friendly for them.
@sauloperez sauloperez force-pushed the export-results-to-csv branch from f68e9c6 to f51d063 Compare October 9, 2020 07:49
And reuse a single action. The meaning is the same.
@@ -7,6 +7,13 @@
/
<%= t "decidim.admin.consultations.results.participants", count: current_consultation.total_participants %>
</span>
<span id="export-consultation-results" class="button--title">
<% if allowed_to?(:export_consultation_results, :consultation, { consultation: current_consultation }, [::Decidim::ActionDelegator::Permissions]) %>
Copy link
Collaborator Author

@sauloperez sauloperez Oct 9, 2020

Choose a reason for hiding this comment

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

This is yet another example of what we need to solve in #24. Permissions are increasingly growing in complexity and that hampers changeability.

In this case, because the controller is on Decidim's core, it does not return our permissions chain, using Decidim::Consultations::Permissions to handle :export_consultation_results.

I'll move on with this and fix it in #24

@sauloperez sauloperez merged commit a532e6f into master Oct 9, 2020
@sauloperez sauloperez deleted the export-results-to-csv branch October 9, 2020 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants