Add extra format for exports

This commit is contained in:
Urban Rotnik 2020-01-10 09:29:20 +01:00
parent 824e116cfa
commit 9296f0eb4f
13 changed files with 29 additions and 3 deletions

View file

@ -58,4 +58,6 @@ class RepositoryAssetValue < ApplicationRecord
value.asset.post_process_file(team)
value
end
alias export_formatted formatted
end

View file

@ -14,8 +14,12 @@ class RepositoryChecklistValue < ApplicationRecord
SORTABLE_COLUMN_NAME = 'repository_checklist_items.data'
SORTABLE_VALUE_INCLUDE = { repository_checklist_value: :repository_checklist_items }.freeze
def formatted
repository_checklist_items.pluck(:data).join(' | ')
def formatted(separator: ' | ')
repository_checklist_items.pluck(:data).join(separator)
end
def export_formatted
formatted(separator: "\n")
end
def data

View file

@ -20,4 +20,6 @@ class RepositoryDateRangeValue < RepositoryDateTimeRangeValueBase
value.end_time = Time.zone.parse(data[:end_time])
value
end
alias export_formatted formatted
end

View file

@ -20,4 +20,6 @@ class RepositoryDateTimeRangeValue < RepositoryDateTimeRangeValueBase
value.end_time = Time.zone.parse(data[:end_time])
value
end
alias export_formatted formatted
end

View file

@ -15,4 +15,6 @@ class RepositoryDateTimeValue < RepositoryDateTimeValueBase
value.data = Time.zone.parse(payload)
value
end
alias export_formatted formatted
end

View file

@ -15,4 +15,6 @@ class RepositoryDateValue < RepositoryDateTimeValueBase
value.data = Time.zone.parse(payload)
value
end
alias export_formatted formatted
end

View file

@ -47,4 +47,6 @@ class RepositoryListValue < ApplicationRecord
.find(payload)
value
end
alias export_formatted formatted
end

View file

@ -32,4 +32,6 @@ class RepositoryNumberValue < ApplicationRecord
value.data = payload.to_f
value
end
alias export_formatted formatted
end

View file

@ -42,4 +42,6 @@ class RepositoryStatusValue < ApplicationRecord
.find(payload)
value
end
alias export_formatted formatted
end

View file

@ -33,4 +33,6 @@ class RepositoryTextValue < ApplicationRecord
value.data = payload
value
end
alias export_formatted formatted
end

View file

@ -21,4 +21,6 @@ class RepositoryTimeRangeValue < RepositoryDateTimeRangeValueBase
value.end_time = Time.zone.parse(data[:end_time])
value
end
alias export_formatted formatted
end

View file

@ -15,4 +15,6 @@ class RepositoryTimeValue < RepositoryDateTimeValueBase
value.data = Time.zone.parse(payload)
value
end
alias export_formatted formatted
end

View file

@ -66,7 +66,7 @@ module RepositoryZipExport
handle_file_name_func.call(cell.value.asset)
else
SmartAnnotations::TagToText.new(
user, team, cell.value.formatted
user, team, cell.value.export_formatted
).text
end
end