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

add duration column to wp journals - hide in activity

ulferts2d3457388ac1
diff --git a/db/migrate/20220505154549_add_duration_to_work_packages.rb b/db/migrate/20220525154549_add_duration_to_work_packages.rb
similarity index 69%
rename from db/migrate/20220505154549_add_duration_to_work_packages.rb
rename to db/migrate/20220525154549_add_duration_to_work_packages.rb
index 845599feacf..2fc2660686f 100644
--- a/db/migrate/20220505154549_add_duration_to_work_packages.rb
+++ b/db/migrate/20220525154549_add_duration_to_work_packages.rb
@@ -1,5 +1,7 @@
class AddDurationToWorkPackages < ActiveRecord::Migration[6.1]
def change
add_column :work_packages, :duration, :integer
+
+ add_column :work_package_journals, :duration, :integer
end
end
diff --git a/lib/api/v3/activities/activity_property_formatters.rb b/lib/api/v3/activities/activity_property_formatters.rb
index f48232a6dfc..effac9e441a 100644
--- a/lib/api/v3/activities/activity_property_formatters.rb
+++ b/lib/api/v3/activities/activity_property_formatters.rb
@@ -39,15 +39,19 @@ module API
def formatted_details(journal)
details = render_details(journal, no_html: true)
html_details = render_details(journal)
- formattables = details.zip(html_details)
- formattables.map { |d| { format: 'custom', raw: d[0], html: d[1] } }
+ details
+ .zip(html_details)
+ .map { |d| { format: 'custom', raw: d[0], html: d[1] } }
end
private
def render_details(journal, no_html: false)
- journal.details.map { |d| journal.render_detail(d, no_html: no_html) }
+ journal
+ .details
+ .map { |d| journal.render_detail(d, no_html:) }
+ .compact
end
def journal_note(journal)
diff --git a/lib/api/v3/activities/activity_representer.rb b/lib/api/v3/activities/activity_representer.rb
index d89cb815eac..c92d84c6f3c 100644
--- a/lib/api/v3/activities/activity_representer.rb
+++ b/lib/api/v3/activities/activity_representer.rb
@@ -26,8 +26,6 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-API::V3::Utilities::DateTimeFormatter
-
module API
module V3
module Activities
@@ -38,7 +36,7 @@ module API
include ActivityPropertyFormatters
self_link path: :activity,
- title_getter: ->(*) { nil }
+ title_getter: ->(*) {}
link :workPackage do
{
@@ -91,10 +89,6 @@ module API
def current_user_allowed_to_edit?
represented.editable_by?(current_user)
end
-
- def render_details(journal, no_html: false)
- journal.details.map { |d| journal.render_detail(d, no_html: no_html) }
- end
end
end
end
diff --git a/spec/models/mail_handler_spec.rb b/spec/models/mail_handler_spec.rb
index 6671e33c4f4..38ad4113e2a 100644
--- a/spec/models/mail_handler_spec.rb
+++ b/spec/models/mail_handler_spec.rb
@@ -603,6 +603,7 @@ describe MailHandler, type: :model do
"status_id" => [original_status.id, resolved_status.id],
"assigned_to_id" => [nil, other_user.id],
"start_date" => [nil, Date.parse("Fri, 01 Jan 2010")],
+ "duration" => [1, 365],
"custom_fields_#{float_cf.id}" => [nil, "52.6"]
)
end