Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

adapt cost reports date handling - date from database

ulfertsc8c725437fa0
diff --git a/modules/reporting/app/models/cost_query/result.rb b/modules/reporting/app/models/cost_query/result.rb
index 8690ae253e2..1f0a309aa6e 100644
--- a/modules/reporting/app/models/cost_query/result.rb
+++ b/modules/reporting/app/models/cost_query/result.rb
@@ -56,7 +56,7 @@ class CostQuery::Result < Report::Result
def start_timestamp
return nil if self["start_time"].blank? || self["time_zone"].blank? || self["spent_on"].blank?
- timestamp(Date.parse(self["spent_on"]), self["start_time"], self["time_zone"])
+ timestamp(self["spent_on"], self["start_time"], self["time_zone"])
end
def end_timestamp
diff --git a/modules/reporting/lib/open_project/reporting/cost_entry_xls_table.rb b/modules/reporting/lib/open_project/reporting/cost_entry_xls_table.rb
index 4606b113ed4..52f3e06cb0e 100644
--- a/modules/reporting/lib/open_project/reporting/cost_entry_xls_table.rb
+++ b/modules/reporting/lib/open_project/reporting/cost_entry_xls_table.rb
@@ -73,7 +73,7 @@ class OpenProject::Reporting::CostEntryXlsTable < OpenProject::XlsExport::XlsVie
end
def cost_main_columns(result)
- main_cols = [show_field(:spent_on, result.fields[:spent_on.to_s])]
+ main_cols = [show_field(:spent_on, result.fields["spent_on"])]
main_cols.concat cost_main_times_columns(result) if with_times_column?
main_cols
end
@@ -133,7 +133,7 @@ class OpenProject::Reporting::CostEntryXlsTable < OpenProject::XlsExport::XlsVie
query
.each_direct_result
.map(&:itself)
- .group_by { |r| DateTime.parse(r.fields["spent_on"]) }
+ .group_by { |r| r.fields["spent_on"] }
.sort
.flat_map { |_, date_results| date_results.sort_by { |r| r.fields["id"] } }
end
diff --git a/modules/xls_export/lib/open_project/xls_export/xls_views.rb b/modules/xls_export/lib/open_project/xls_export/xls_views.rb
index 859039037cb..d3b038de2a2 100644
--- a/modules/xls_export/lib/open_project/xls_export/xls_views.rb
+++ b/modules/xls_export/lib/open_project/xls_export/xls_views.rb
@@ -11,7 +11,7 @@ class OpenProject::XlsExport::XlsViews
def field_representation_map(key, value)
case key.to_sym
when :units then value.to_i
- when :spent_on then value
+ when :spent_on then value.iso8601
when :activity_id then mapped value, Enumeration, I18n.t("placeholders.default")
when :project_id then project_representation(value)
when :user_id, :assigned_to_id then user_representation(value)