mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 16:20:12 +01:00
fix #891. Somehow the assignment causes an error for some people.
Don't know why though, but this fix is harmless anyway.
This commit is contained in:
parent
5e859f6b78
commit
ceba367942
1 changed files with 10 additions and 11 deletions
|
|
@ -53,23 +53,22 @@ class DataController < ApplicationController
|
||||||
csv << ["id", "Context", "Project", "Description", "Notes", "Tags",
|
csv << ["id", "Context", "Project", "Description", "Notes", "Tags",
|
||||||
"Created at", "Due", "Completed at", "User ID", "Show from",
|
"Created at", "Due", "Completed at", "User ID", "Show from",
|
||||||
"state"]
|
"state"]
|
||||||
current_user.todos.find(:all, :include => [:context, :project, :tags]).each do |todo|
|
current_user.todos.find(:all, :include => [:context, :project]).each do |todo|
|
||||||
# Format dates in ISO format for easy sorting in spreadsheet Print
|
csv << [todo.id, todo.context.name,
|
||||||
# context and project names for easy viewing
|
todo.project_id.nil? ? "" : todo.project.name,
|
||||||
csv << [todo.id, todo.context.name,
|
todo.description,
|
||||||
todo.project_id = todo.project_id.nil? ? "" : todo.project.name,
|
|
||||||
todo.description,
|
|
||||||
todo.notes, todo.tags.collect{|t| t.name}.join(', '),
|
todo.notes, todo.tags.collect{|t| t.name}.join(', '),
|
||||||
todo.created_at.to_formatted_s(:db),
|
todo.created_at.to_formatted_s(:db),
|
||||||
todo.due = todo.due? ? todo.due.to_formatted_s(:db) : "",
|
todo.due? ? todo.due.to_formatted_s(:db) : "",
|
||||||
todo.completed_at = todo.completed_at? ? todo.completed_at.to_formatted_s(:db) : "",
|
todo.completed_at? ? todo.completed_at.to_formatted_s(:db) : "",
|
||||||
todo.user_id,
|
todo.user_id,
|
||||||
todo.show_from = todo.show_from? ? todo.show_from.to_formatted_s(:db) : "",
|
todo.show_from? ? todo.show_from.to_formatted_s(:db) : "",
|
||||||
todo.state]
|
todo.state]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
send_data(result, :filename => "todos.csv", :type => content_type)
|
send_data(result, :filename => "todos.csv", :type => content_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def csv_notes
|
def csv_notes
|
||||||
content_type = 'text/csv'
|
content_type = 'text/csv'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue