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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Excel format exporter #2099

Merged
merged 5 commits into from
Oct 24, 2017
Merged

Add Excel format exporter #2099

merged 5 commits into from
Oct 24, 2017

Conversation

josepjaume
Copy link
Contributor

@josepjaume josepjaume commented Oct 23, 2017

馃帺 What? Why?

This adds an explicit Excel exporter that exports to a Spreadsheet instead of a CSV, which is causing lots of issues (mainly due to the undocumented nature of CSV itself).

馃搶 Related Issues

None

馃搵 Subtasks

None

馃摲 Screenshots (optional)

None

馃懟 GIF

None

@josepjaume josepjaume added the type: bug Issues that describe a bug label Oct 23, 2017
@ghost ghost assigned josepjaume Oct 23, 2017
@ghost ghost added in-progress and removed type: bug Issues that describe a bug labels Oct 23, 2017
@@ -16,13 +16,13 @@ class CSV < Exporter
#
# Returns an ExportData instance.
def export
data = ::CSV.generate(headers: headers, write_headers: true, col_sep: ";") do |csv|
data = ::CSV.generate(headers: headers, write_headers: true, col_sep: "\t") do |csv|
Copy link
Contributor

Choose a reason for hiding this comment

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

Separated with tabs? O_o'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Excel is freaking weird, I'm looking at an alternate solution.

mrcasals
mrcasals previously approved these changes Oct 23, 2017
@codecov
Copy link

codecov bot commented Oct 24, 2017

Codecov Report

Merging #2099 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2099      +/-   ##
==========================================
+ Coverage   98.55%   98.56%   +<.01%     
==========================================
  Files        1174     1176       +2     
  Lines       26847    26889      +42     
==========================================
+ Hits        26460    26502      +42     
  Misses        387      387

@josepjaume josepjaume changed the title Fix csv exporter to work with excel out of the box Add Excel format exporter Oct 24, 2017
@@ -5,14 +5,15 @@ module Exporters
autoload :Exporter, "decidim/exporters/exporter"
autoload :JSON, "decidim/exporters/json"
autoload :CSV, "decidim/exporters/csv"
autoload :Excel, "decidim/exporters/excel"
autoload :ExportData, "decidim/exporters/export_data"
autoload :Serializer, "decidim/exporters/serializer"

# Get the exporter class constant from the format as a string.
#
# format - The exporter format as a string. i.e "csv"
Copy link
Contributor

Choose a reason for hiding this comment

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

Update the docs (upcase "CSV")?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right!

@@ -10,7 +10,7 @@ class Exporter
#
# collection - An Array with the collection to be exported.
# serializer - A Serializer to be used during the export.
def initialize(collection, serializer)
def initialize(collection, serializer = Serializer)
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this Serializer?? Is this something from our code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it's a passthrough serializer, returns the object itself.

mrcasals
mrcasals previously approved these changes Oct 24, 2017
Copy link
Contributor

@mrcasals mrcasals left a comment

Choose a reason for hiding this comment

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

Looks good!

mrcasals
mrcasals previously approved these changes Oct 24, 2017
@josepjaume josepjaume merged commit a82779f into master Oct 24, 2017
@josepjaume josepjaume deleted the fix_csv_exporter branch October 24, 2017 09:25
@ghost ghost removed the in-progress label Oct 24, 2017
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.

None yet

2 participants