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
Move time entry activity names into the seeder files
Christophe Bliardb319f7732dbf
diff --git a/app/seeders/basic_data/activity_seeder.rb b/app/seeders/basic_data/activity_seeder.rbindex 28857719ed7..b7ec60afa99 100644--- a/app/seeders/basic_data/activity_seeder.rb+++ b/app/seeders/basic_data/activity_seeder.rb@@ -29,22 +29,22 @@ module BasicDataclass ActivitySeeder < Seederdef seed_data!TimeEntryActivity.transaction do- data.each do |attributes|- TimeEntryActivity.create(attributes)+ seed_data.each('time_entry_activities') do |activity_data|+ TimeEntryActivity.create(+ name: activity_data['name'],+ position: activity_data['position'],+ is_default: true?(activity_data['is_default'])+ )endendenddef applicable?- TimeEntryActivity.all.empty?+ TimeEntryActivity.none?enddef not_applicable_message'Skipping activities as there are already some configured'end-- def data- raise NotImplementedError- endendenddiff --git a/app/seeders/basic_data/status_seeder.rb b/app/seeders/basic_data/status_seeder.rbindex 117b19fa639..7f7069387cf 100644--- a/app/seeders/basic_data/status_seeder.rb+++ b/app/seeders/basic_data/status_seeder.rb@@ -29,33 +29,21 @@ module BasicDataclass StatusSeeder < Seederdef seed_data!Status.transaction do- data.each do |attributes|- reference = attributes.delete(:reference)- status = Status.create!(attributes)- seed_data.store_reference(reference, status)+ Array(seed_data.lookup('statuses')).each do |status_data|+ status = Status.create!(status_attributes(status_data))+ seed_data.store_reference(status_data['reference'], status)endendend- def applicable- Status.all.any?- end-- def not_applicable_message- 'Skipping statuses - already exists/configured'- end-- def data- Array(seed_data.lookup('statuses')).map do |status_data|- {- reference: status_data['reference'],- name: status_data['name'],- color_id: color_id(status_data['color_name']),- is_closed: true?(status_data['is_closed']),- is_default: true?(status_data['is_default']),- position: status_data['position']- }- end+ def status_attributes(status_data)+ {+ name: status_data['name'],+ color_id: color_id(status_data['color_name']),+ is_closed: true?(status_data['is_closed']),+ is_default: true?(status_data['is_default']),+ position: status_data['position']+ }endprotecteddiff --git a/app/seeders/standard.yml b/app/seeders/standard.ymlindex 3d6ce4e4853..0df8e79e911 100644--- a/app/seeders/standard.yml+++ b/app/seeders/standard.yml@@ -30,88 +30,78 @@ statuses:- reference: :default_status_newt_name: Newcolor_name: cyan-7- is_closed: falseis_default: trueposition: 1- reference: :default_status_in_specificationt_name: In specificationcolor_name: blue-2- is_closed: false- is_default: falseposition: 2- reference: :default_status_specifiedt_name: Specifiedcolor_name: blue-2- is_closed: false- is_default: falseposition: 3- reference: :default_status_confirmedt_name: Confirmedcolor_name: violet-2- is_closed: false- is_default: falseposition: 4- reference: :default_status_to_be_scheduledt_name: To be scheduledcolor_name: yellow-2- is_closed: false- is_default: falseposition: 5- reference: :default_status_scheduledt_name: Scheduledcolor_name: lime-2- is_closed: false- is_default: falseposition: 6- reference: :default_status_in_progresst_name: In progresscolor_name: grape-5- is_closed: false- is_default: falseposition: 7- reference: :default_status_developedt_name: Developedcolor_name: green-3- is_closed: false- is_default: falseposition: 8- reference: :default_status_in_testingt_name: In testingcolor_name: cyan-5- is_closed: false- is_default: falseposition: 9- reference: :default_status_testedt_name: Testedcolor_name: teal-6- is_closed: false- is_default: falseposition: 10- reference: :default_status_test_failedt_name: Test failedcolor_name: red-5- is_closed: false- is_default: falseposition: 11- reference: :default_status_closedt_name: Closedcolor_name: gray-3is_closed: true- is_default: falseposition: 12- reference: :default_status_on_holdt_name: On holdcolor_name: orange-3- is_closed: false- is_default: falseposition: 13- reference: :default_status_rejectedt_name: Rejectedcolor_name: red-3is_closed: true- is_default: falseposition: 14+time_entry_activities:+- t_name: Management+ is_default: true+ position: 1+- t_name: Specification+ position: 2+- t_name: Development+ position: 3+- t_name: Testing+ position: 4+- t_name: Support+ position: 5+- t_name: Other+ position: 6+welcome:t_title: "Welcome to OpenProject!"t_text: |diff --git a/app/seeders/standard/basic_data/activity_seeder.rb b/app/seeders/standard/basic_data/activity_seeder.rbdeleted file mode 100644index 07d7d474160..00000000000--- a/app/seeders/standard/basic_data/activity_seeder.rb+++ /dev/null@@ -1,43 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2023 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2013 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See COPYRIGHT and LICENSE files for more details.-#++-module Standard- module BasicData- class ActivitySeeder < ::BasicData::ActivitySeeder- def data- [- { name: I18n.t(:default_activity_management), position: 1, is_default: true },- { name: I18n.t(:default_activity_specification), position: 2, is_default: false },- { name: I18n.t(:default_activity_development), position: 3, is_default: false },- { name: I18n.t(:default_activity_testing), position: 4, is_default: false },- { name: I18n.t(:default_activity_support), position: 5, is_default: false },- { name: I18n.t(:default_activity_other), position: 6, is_default: false }- ]- end- end- end-enddiff --git a/app/seeders/standard/basic_data_seeder.rb b/app/seeders/standard/basic_data_seeder.rbindex 680f82f20f8..0ff4e02d743 100644--- a/app/seeders/standard/basic_data_seeder.rb+++ b/app/seeders/standard/basic_data_seeder.rb@@ -32,7 +32,7 @@ module Standard::BasicData::BuiltinUsersSeeder,::BasicData::BuiltinRolesSeeder,::BasicData::RoleSeeder,- ::Standard::BasicData::ActivitySeeder,+ ::BasicData::ActivitySeeder,::BasicData::ColorSeeder,::BasicData::ColorSchemeSeeder,::Standard::BasicData::WorkflowSeeder,diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 6cbe82db50f..8d4d1fbdc0d 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -1223,7 +1223,7 @@ en:short: "%b %d"# Don't forget the nil at the beginning; there's no such thing as a 0th monthmonth_names: [ ~, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]- # Used in date_select and datime_select.+ # Used in date_select and datetime_select.order:- :year- :month@@ -1270,12 +1270,6 @@ en:one: "hour"other: "hours"- default_activity_development: "Development"- default_activity_management: "Management"- default_activity_other: "Other"- default_activity_specification: "Specification"- default_activity_support: "Support"- default_activity_testing: "Testing"default_color_black: "Black"default_color_blue: "Blue"default_color_blue_dark: "Blue (dark)"diff --git a/modules/bim/app/seeders/bim.yml b/modules/bim/app/seeders/bim.ymlindex 05499ac200f..6502c1527b3 100644--- a/modules/bim/app/seeders/bim.yml+++ b/modules/bim/app/seeders/bim.yml@@ -46,6 +46,15 @@ statuses:is_closed: trueposition: 4+time_entry_activities:+ - t_name: Management+ is_default: true+ position: 1+ - t_name: Specification+ position: 2+ - t_name: Other+ position: 3+global_queries:- t_name: "Embedded table: Children"reference: :global_query__childrendiff --git a/modules/bim/app/seeders/bim/basic_data/activity_seeder.rb b/modules/bim/app/seeders/bim/basic_data/activity_seeder.rbdeleted file mode 100644index 6c724c467e9..00000000000--- a/modules/bim/app/seeders/bim/basic_data/activity_seeder.rb+++ /dev/null@@ -1,40 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2023 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2013 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See COPYRIGHT and LICENSE files for more details.-#++-module Bim- module BasicData- class ActivitySeeder < ::BasicData::ActivitySeeder- def data- [- { name: I18n.t(:default_activity_management), position: 1, is_default: true },- { name: I18n.t(:default_activity_specification), position: 2, is_default: false },- { name: I18n.t(:default_activity_other), position: 3, is_default: false }- ]- end- end- end-enddiff --git a/modules/bim/app/seeders/bim/basic_data_seeder.rb b/modules/bim/app/seeders/bim/basic_data_seeder.rbindex e2059e5a840..17ddb171347 100644--- a/modules/bim/app/seeders/bim/basic_data_seeder.rb+++ b/modules/bim/app/seeders/bim/basic_data_seeder.rb@@ -32,7 +32,7 @@ module Bim::BasicData::BuiltinUsersSeeder,::BasicData::BuiltinRolesSeeder,::Bim::BasicData::RoleSeeder,- ::Bim::BasicData::ActivitySeeder,+ ::BasicData::ActivitySeeder,::BasicData::ColorSeeder,::BasicData::ColorSchemeSeeder,::Bim::BasicData::WorkflowSeeder,diff --git a/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb b/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rbindex 29e71394a0b..f7a591e2769 100644--- a/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb+++ b/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb@@ -81,6 +81,14 @@ describe RootSeeder,it 'creates workflows' doexpect(Workflow.count).to eq(182)end++ it 'creates statuses' do+ expect(Status.count).to eq(4)+ end++ it 'creates time entry activities' do+ expect(TimeEntryActivity.count).to eq(3)+ endenddescribe 'demo data' dodiff --git a/spec/seeders/root_seeder_standard_edition_spec.rb b/spec/seeders/root_seeder_standard_edition_spec.rbindex e75cc0abf7d..4fd6ff012f3 100644--- a/spec/seeders/root_seeder_standard_edition_spec.rb+++ b/spec/seeders/root_seeder_standard_edition_spec.rb@@ -81,6 +81,14 @@ describe RootSeeder,it 'creates workflows' doexpect(Workflow.count).to eq(1172)end++ it 'creates statuses' do+ expect(Status.count).to eq(14)+ end++ it 'creates time entry activities' do+ expect(TimeEntryActivity.count).to eq(6)+ endenddescribe 'demo data' do