Skip to content

Commit

Permalink
Wrap export in quotes to preserve commas
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Mar 14, 2016
1 parent 4a8573c commit 699e007
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions assets/js/admin/reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ jQuery(function( $ ) {

var the_series = window.main_chart.getData();
var series = [];
csv_data += xaxes_label + ',';
csv_data += '"' + xaxes_label + '",';

$.each( the_series, function( index, value ) {
if ( ! exclude_series || $.inArray( index.toString(), exclude_series ) === -1 ) {
Expand All @@ -185,7 +185,7 @@ jQuery(function( $ ) {

// CSV Headers
for ( s = 0; s < series.length; ++s ) {
csv_data += series[s].label + ',';
csv_data += '"' + series[s].label + '",';
}

csv_data = csv_data.substring( 0, csv_data.length - 1 );
Expand Down Expand Up @@ -218,9 +218,9 @@ jQuery(function( $ ) {
var date = new Date( parseInt( index, 10 ) );

if ( groupby === 'day' ) {
csv_data += date.getUTCFullYear() + '-' + parseInt( date.getUTCMonth() + 1, 10 ) + '-' + date.getUTCDate() + ',';
csv_data += '"' + date.getUTCFullYear() + '-' + parseInt( date.getUTCMonth() + 1, 10 ) + '-' + date.getUTCDate() + '",';
} else {
csv_data += date.getUTCFullYear() + '-' + parseInt( date.getUTCMonth() + 1, 10 ) + ',';
csv_data += '"' + date.getUTCFullYear() + '-' + parseInt( date.getUTCMonth() + 1, 10 ) + '",';
}

for ( var d = 0; d < value.length; ++d ) {
Expand All @@ -231,7 +231,7 @@ jQuery(function( $ ) {
val = val.toFixed( 2 );
}

csv_data += val + ',';
csv_data += '"' + val + '",';
}
csv_data = csv_data.substring( 0, csv_data.length - 1 );
csv_data += '\n';
Expand Down
2 changes: 1 addition & 1 deletion assets/js/admin/reports.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/frontend/cart-fragments.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 699e007

Please sign in to comment.