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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
clearer differ association method names
Ivan Kuchin4e16122a459c
diff --git a/app/models/journable/with_historic_attributes.rb b/app/models/journable/with_historic_attributes.rbindex 6ff5d61b6aa..eb59ebe8fff 100644--- a/app/models/journable/with_historic_attributes.rb+++ b/app/models/journable/with_historic_attributes.rb@@ -254,7 +254,7 @@ class Journable::WithHistoricAttributes < SimpleDelegatorassociation: :custom_values,id_attribute: :custom_field_id,all_values: :joined- ).attribute_changes(+ ).single_attribute_changes(:value,key_prefix: "custom_field")diff --git a/lib_static/plugins/acts_as_journalized/lib/acts/journalized/differ/association.rb b/lib_static/plugins/acts_as_journalized/lib/acts/journalized/differ/association.rbindex 05356acdb2c..bd1f08af905 100644--- a/lib_static/plugins/acts_as_journalized/lib/acts/journalized/differ/association.rb+++ b/lib_static/plugins/acts_as_journalized/lib/acts/journalized/differ/association.rb@@ -37,14 +37,14 @@ module Acts::Journalized::Differ@all_values = all_valuesend- def attribute_changes(attribute, key_prefix:)- single_attribute_changes(attribute)+ def single_attribute_changes(attribute, key_prefix:)+ attribute_changes(attribute).transform_keys { |id| "#{key_prefix}_#{id}" }end- def attributes_changes(attributes, key_prefix:, grouped: false)+ def multiple_attributes_changes(attributes, key_prefix:, grouped: false)attributes.each_with_object({}) do |attribute, result|- single_attribute_changes(attribute).each do |id, change|+ attribute_changes(attribute).each do |id, change|if groupedresult["#{key_prefix}_#{id}"] ||= {}result["#{key_prefix}_#{id}"][attribute] = change@@ -69,7 +69,7 @@ module Acts::Journalized::Differrelation.group_by(&id_attribute.to_sym)end- def single_attribute_changes(attribute)+ def attribute_changes(attribute)attribute = attribute.to_sympairs = @ids.index_with do |id|diff --git a/lib_static/plugins/acts_as_journalized/lib/journal_changes.rb b/lib_static/plugins/acts_as_journalized/lib/journal_changes.rbindex b2c52921f95..8ed905c7d66 100644--- a/lib_static/plugins/acts_as_journalized/lib/journal_changes.rb+++ b/lib_static/plugins/acts_as_journalized/lib/journal_changes.rb@@ -63,7 +63,7 @@ module JournalChangesassociation: :attachable_journals,id_attribute: :attachment_id,all_values: :joined- ).attribute_changes(+ ).single_attribute_changes(:filename,key_prefix: "attachments")@@ -88,7 +88,7 @@ module JournalChangesassociation:,id_attribute: :custom_field_id,all_values: :joined- ).attribute_changes(+ ).single_attribute_changes(:value,key_prefix: "custom_fields")@@ -102,7 +102,7 @@ module JournalChangesself,association: :project_life_cycle_step_journals,id_attribute: :life_cycle_step_id- ).attributes_changes(+ ).multiple_attributes_changes(%i[active date date_range],key_prefix: "project_life_cycle_step",grouped: true@@ -127,7 +127,7 @@ module JournalChangesassociation: :agenda_item_journals,id_attribute: :agenda_item_id,all_values: :joined- ).attributes_changes(+ ).multiple_attributes_changes(%i[title duration_in_minutes notes position work_package_id],key_prefix: "agenda_items")diff --git a/spec/lib/acts/journalized/differ/association_spec.rb b/spec/lib/acts/journalized/differ/association_spec.rbindex f94f7f59633..2167d2c1966 100644--- a/spec/lib/acts/journalized/differ/association_spec.rb+++ b/spec/lib/acts/journalized/differ/association_spec.rb@@ -31,7 +31,7 @@require "spec_helper"RSpec.describe Acts::Journalized::Differ::Association do- describe "#attribute_changes" do+ describe "#single_attribute_changes" dolet(:original) dobuild(:work_package,custom_values: [@@ -75,7 +75,7 @@ RSpec.describe Acts::Journalized::Differ::Association doendsubject(:result) do- instance.attribute_changes(:value, key_prefix: "custom_field")+ instance.single_attribute_changes(:value, key_prefix: "custom_field")enddescribe "requesting all values changes joined" do@@ -128,7 +128,7 @@ RSpec.describe Acts::Journalized::Differ::Association doendend- describe "#attributes_changes" do+ describe "#multiple_attributes_changes" dolet(:original) dobuild(:journal, project_life_cycle_step_journals: [build_stubbed(:project_life_cycle_step_journal, life_cycle_step_id: 1, active: false),@@ -161,7 +161,7 @@ RSpec.describe Acts::Journalized::Differ::Association dodescribe "by default" dosubject(:result) do- instance.attributes_changes(+ instance.multiple_attributes_changes(%i[active start_date end_date],key_prefix: "project_life_cycle_steps")@@ -204,7 +204,7 @@ RSpec.describe Acts::Journalized::Differ::Association dodescribe "grouped" dosubject(:result) do- instance.attributes_changes(+ instance.multiple_attributes_changes(%i[active start_date end_date],key_prefix: "project_life_cycle_steps",grouped: true