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
Make bim.yml immune to translations by using references
Christophe Bliard6513c882ed03
diff --git a/app/seeders/demo_data/group_seeder.rb b/app/seeders/demo_data/group_seeder.rbindex 5a04354980b..c991233b169 100644--- a/app/seeders/demo_data/group_seeder.rb+++ b/app/seeders/demo_data/group_seeder.rb@@ -43,7 +43,8 @@ module DemoDatadef seed_groupsseed_data.each('groups') do |group_data|- create_group group_data['name']+ group = create_group group_data['name']+ seed_data.store_reference(group_data['reference'], group)endenddiff --git a/app/seeders/demo_data/work_package_board_seeder.rb b/app/seeders/demo_data/work_package_board_seeder.rbindex f529ecab395..5650f77af71 100644--- a/app/seeders/demo_data/work_package_board_seeder.rb+++ b/app/seeders/demo_data/work_package_board_seeder.rb@@ -101,15 +101,12 @@ module DemoDataenddef seed_kanban_board_queries- status_keys = %i[default_status_new default_status_in_progress default_status_closed default_status_rejected]- status_names = status_keys.map { I18n.t(_1) }- statuses = Status.where(name: status_names).to_a-- if statuses.size < status_names.size- raise StandardError.new "Not all statuses needed for seeding a KANBAN board are present. Check that they get seeded."- end-- statuses.to_a.map do |status|+ statuses(+ 'default_status_new',+ 'default_status_in_progress',+ 'default_status_closed',+ 'default_status_rejected'+ ).map do |status|Query.new_default(project:, user:).tap do |query|# Make it public so that new members can see it tooquery.public = true@@ -126,6 +123,17 @@ module DemoDataendend+ def statuses(*status_i18n_keys)+ status_names = status_i18n_keys.map { I18n.t(_1) }+ statuses = Status.where(name: status_names).to_a++ if statuses.size < status_names.size+ raise StandardError, "Not all statuses needed for seeding a board are present. Check that they got seeded."+ end++ statuses.to_a+ end+def seed_basic_board(board_data)widgets = seed_basic_board_widgets(board_data)board =diff --git a/app/seeders/demo_data/work_package_seeder.rb b/app/seeders/demo_data/work_package_seeder.rbindex 5438fec8c73..072b52d20b8 100644--- a/app/seeders/demo_data/work_package_seeder.rb+++ b/app/seeders/demo_data/work_package_seeder.rb@@ -126,12 +126,8 @@ module DemoDataendend- def find_principal(lastname)- if lastname.present?- Principal.find_by!(lastname:)- else- user- end+ def find_principal(reference)+ seed_data.find_reference(reference) || userenddef find_priority(attributes)diff --git a/app/seeders/seed_data.rb b/app/seeders/seed_data.rbindex b85d12035da..e45b12ccb69 100644--- a/app/seeders/seed_data.rb+++ b/app/seeders/seed_data.rb@@ -36,6 +36,9 @@ class SeedDatadef store_reference(reference, record)return if reference.nil?+ if registry.key?(reference)+ raise ArgumentError, "an object with reference #{reference.inspect} is already registered"+ endregistry[reference] = recordenddiff --git a/app/seeders/standard.yml b/app/seeders/standard.ymlindex 75e587ec526..b352a1455af 100644--- a/app/seeders/standard.yml+++ b/app/seeders/standard.yml@@ -124,7 +124,7 @@ projects:- t_name: 'Short list'work_packages:- :invite_attendees_to_conference- - t_name: 'Prio list for today'+ - t_name: 'Priority list for today'work_packages:- :set_date_and_location_of_conference- t_name: 'Never'@@ -467,7 +467,7 @@ projects:- t_name: 'Short list'work_packages:- :new_login_screen- - t_name: 'Prio list for today'+ - t_name: 'Priority list for today'work_packages:- :set_up_staging_environment- t_name: 'Never'diff --git a/modules/bim/app/seeders/bim.yml b/modules/bim/app/seeders/bim.ymlindex 7f2ff032d35..d71c21cc10c 100644--- a/modules/bim/app/seeders/bim.yml+++ b/modules/bim/app/seeders/bim.yml@@ -49,12 +49,18 @@ type_configuration:query: :global_query__childrengroups:- t_name: Architects+ reference: :group__architects- t_name: BIM Coordinators+ reference: :group__bim_coordinators- t_name: BIM Managers+ reference: :group__bim_managers- t_name: BIM Modellers+ reference: :group__bim_modellers- t_name: Lead BIM Coordinators+ reference: :group__lead_bim_coordinators- t_name: MEP Engineers- t_name: Planners+ reference: :group__planners- t_name: Structural Engineerswelcome:t_title: "Welcome to OpenProject BIM edition!"@@ -114,6 +120,7 @@ projects:- duration- assigned_to- t_name: Milestones+ reference: :demo_construction_project__query__milestonesstatus: opentype: :default_type_milestonetimeline: true@@ -215,8 +222,7 @@ projects:end_column: 3options:t_name: 'Milestones'- # TODO: ref wont be found with another language- queryId: '##query.id:"Milestones"'+ queryId: '##query.id:demo_construction_project__query__milestones'work_packages: []demo-planning-constructing-project:t_name: (Demo) Planning & constructing@@ -260,6 +266,7 @@ projects:- due_date- duration- t_name: Milestones+ reference: :demo_planning_constructing_project__query__milestonesstatus: opentype: :default_type_milestonetimeline: true@@ -354,7 +361,7 @@ projects:end_column: 3options:t_name: 'Milestones'- queryId: '##query.id:"Milestones"'+ queryId: '##query.id:demo_planning_constructing_project__query__milestones'work_packages:- :start: 4:t_subject: Project kick off construction project@@ -365,8 +372,7 @@ projects:The next step could be checking out the timetable and adjusting the appointments, by looking at the [Gantt chart]({{opSetting:base_url}}/projects/demo-construction-project/work_packages?query_props=%7B%22c%22%3A%5B%22id%22%2C%22subject%22%2C%22startDate%22%2C%22dueDate%22%5D%2C%22tv%22%3Atrue%2C%22tzl%22%3A%22weeks%22%2C%22hi%22%3Atrue%2C%22g%22%3A%22%22%2C%22t%22%3A%22startDate%3Aasc%22%2C%22f%22%3A%5B%7B%22n%22%3A%22status%22%2C%22o%22%3A%22o%22%2C%22v%22%3A%5B%5D%7D%5D%2C%22pa%22%3A1%2C%22pp%22%3A100%7D).:status: default_status_new:type: default_type_milestone- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 1- :start: 7:t_subject: Basic evaluation@@ -391,8 +397,7 @@ projects:* Derive the cost estimation and time frame:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 4- :start: 14:t_subject: Summarize the results@@ -412,8 +417,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 4:relations:- :to: :gathering_first_project_information@@ -425,13 +429,12 @@ projects:and "Request", thus represents a general note.:status: default_status_new:type: default_type_milestone- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 1:relations:- :to: :summarize_the_results:type: follows- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 14:relations:- :to: :project_kick_off_construction_project@@ -461,8 +464,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 10:relations:- :to: :end_of_basic_evaluation@@ -485,13 +487,12 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 4:relations:- :to: :developing_first_draft:type: follows- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 17- :start: 42:t_subject: Passing of preliminary planning@@ -500,8 +501,7 @@ projects:and "Request", thus represents a general note.:status: default_status_new:type: default_type_milestone- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 1:relations:- :to: :summarize_results@@ -530,8 +530,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 45:relations:- :to: :passing_of_preliminary_planning@@ -543,14 +542,12 @@ projects:and "Request", thus represents a general note.:status: default_status_new:type: default_type_milestone- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 1:relations:- :to: :finishing_design:type: follows- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 46- :start: 98:t_subject: Construction phase@@ -575,8 +572,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 31- :start: 130:t_subject: Foundation@@ -593,8 +589,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 25:relations:- :to: :start_constructing@@ -616,8 +611,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 46- :start: 164:t_subject: Finishing the facade@@ -635,8 +629,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 32- :start: 178:t_subject: Installing the building service systems@@ -653,8 +646,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 25- :start: 189:t_subject: Final touches@@ -674,8 +666,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 18- :start: 208:t_subject: House warming party@@ -695,8 +686,7 @@ projects::relations:- :to: :final_touches:type: follows- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 110:relations:- :to: :design_freeze@@ -743,6 +733,7 @@ projects:- due_date- duration- t_name: Milestones+ reference: :demo_bim_project__query__milestonesstatus: opentype: :default_type_milestonetimeline: true@@ -840,8 +831,7 @@ projects:end_column: 3options:t_name: 'Milestones'- # TODO: ref wont be found with another language- queryId: '##query.id:"Milestones"'+ queryId: '##query.id:demo_bim_project__query__milestones'work_packages:- :start: 14:t_subject: Project kick off creating BIM model@@ -852,8 +842,7 @@ projects:The next step could be to check out the timetable and adjusting the appointments, by looking at the [Gantt chart]({{opSetting:base_url}}/projects/demo-bim-project/work_packages?query_props=%7B%22c%22%3A%5B%22id%22%2C%22subject%22%2C%22startDate%22%2C%22dueDate%22%5D%2C%22tv%22%3Atrue%2C%22tzl%22%3A%22weeks%22%2C%22hi%22%3Atrue%2C%22g%22%3A%22%22%2C%22t%22%3A%22startDate%3Aasc%22%2C%22f%22%3A%5B%7B%22n%22%3A%22status%22%2C%22o%22%3A%22o%22%2C%22v%22%3A%5B%5D%7D%5D%2C%22pa%22%3A1%2C%22pp%22%3A100%7D).:status: default_status_new:type: default_type_milestone- # TODO: ref wont be found with another language- :assigned_to: BIM Managers+ :assigned_to: :group__bim_managers:duration: 1- :start: 15:t_subject: Project preparation@@ -882,8 +871,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 14:relations:- :to: :project_kick_off_creating_bim_model@@ -904,7 +892,7 @@ projects:* ...:status: default_status_new:type: default_type_task- :assigned_to: Lead BIM Coordinators+ :assigned_to: :group__lead_bim_coordinators:duration: 18:relations:- :to: :gathering_project_data_and_info@@ -916,13 +904,12 @@ projects:and "Request", thus represents a general note.:status: bim.default_status_resolved:type: default_type_milestone- :assigned_to: BIM Coordinators+ :assigned_to: :group__bim_coordinators:duration: 1:relations:- :to: :creating_bim_execution_plan:type: follows- # TODO: ref wont be found with another language- :assigned_to: BIM Managers+ :assigned_to: :group__bim_managers:duration: 37- :start: 53:t_subject: End of preparation phase@@ -931,8 +918,7 @@ projects:and "Request", thus represents a general note.:status: default_status_new:type: default_type_milestone- # TODO: ref wont be found with another language- :assigned_to: BIM Managers+ :assigned_to: :group__bim_managers:duration: 1:relations:- :to: :project_preparation@@ -960,8 +946,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 7:relations:- :to: :end_of_preparation_phase@@ -980,8 +965,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: Lead BIM Coordinators+ :assigned_to: :group__lead_bim_coordinators:duration: 2:relations:- :to: :modelling_initial_bim_model@@ -993,14 +977,12 @@ projects:and "Request", thus represents a general note.:status: default_status_new:type: default_type_milestone- # TODO: ref wont be found with another language- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 1:relations:- :to: :initial_internal_model_check_and_revising:type: follows- # TODO: ref wont be found with another language- :assigned_to: Architects+ :assigned_to: :group__architects:duration: 11:relations:- :to: :completion_of_bim_execution_plan@@ -1027,8 +1009,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 1:relations:- :to: :submitting_initial_bim_model@@ -1048,8 +1029,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 6:relations:- :to: :referencing_external_bim_models@@ -1068,7 +1048,7 @@ projects:* ...:status: default_status_new:type: default_type_task- :assigned_to: BIM Coordinators+ :assigned_to: :group__bim_coordinators:duration: 1:relations:- :to: :modelling_of_the_bim_model@@ -1080,14 +1060,12 @@ projects:and "Request", thus represents a general note.:status: default_status_new:type: default_type_milestone- # TODO: ref wont be found with another language- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 1:relations:- :to: :first_cycle_internal_model_check_and_revising:type: follows- # TODO: ref wont be found with another language- :assigned_to: BIM Coordinators+ :assigned_to: :group__bim_coordinators:duration: 10:relations:- :to: :submitting_initial_bim_model@@ -1114,8 +1092,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: BIM Coordinators+ :assigned_to: :group__bim_coordinators:duration: 3- :start: 77:t_subject: Issue management, first cycle@@ -1123,8 +1100,7 @@ projects::description: '':status: default_status_new:type: default_type_phase- # TODO: ref wont be found with another language- :assigned_to: BIM Coordinators+ :assigned_to: :group__bim_coordinators:duration: 4- :start: 82:t_subject: Finishing coordination, first cycle@@ -1133,14 +1109,12 @@ projects:and "Request", thus represents a general note.:status: default_status_new:type: default_type_milestone- # TODO: ref wont be found with another language- :assigned_to: Lead BIM Coordinators+ :assigned_to: :group__lead_bim_coordinators:duration: 1:relations:- :to: :issue_management_first_cycle:type: follows- # TODO: ref wont be found with another language- :assigned_to: Lead BIM Coordinators+ :assigned_to: :group__lead_bim_coordinators:duration: 5:relations:- :to: :submitting_bim_model@@ -1151,8 +1125,7 @@ projects::t_description: "## Goal\r\n\r\n* ...\r\n\r\n## Description\r\n\r\n* ...":status: default_status_new:type: default_type_phase- # TODO: ref wont be found with another language- :assigned_to: Lead BIM Coordinators+ :assigned_to: :group__lead_bim_coordinators:duration: 1:relations:- :to: :finishing_coordination_first_cycle@@ -1164,8 +1137,7 @@ projects:and "Request", thus represents a general note.:status: default_status_new:type: default_type_phase- # TODO: ref wont be found with another language- :assigned_to: Lead BIM Coordinators+ :assigned_to: :group__lead_bim_coordinators:duration: 1:relations:- :to: :modelling_and_coordinating_second_cycle@@ -1176,8 +1148,7 @@ projects::t_description: "## Goal\r\n\r\n* ...\r\n\r\n## Description\r\n\r\n* ...":status: default_status_new:type: default_type_phase- # TODO: ref wont be found with another language- :assigned_to: Lead BIM Coordinators+ :assigned_to: :group__lead_bim_coordinators:duration: 1:relations:- :to: :modelling_and_coordinating_another_cycle@@ -1189,8 +1160,7 @@ projects:and "Request", thus represents a general note.:status: default_status_new:type: default_type_phase- # TODO: ref wont be found with another language- :assigned_to: BIM Coordinators+ :assigned_to: :group__bim_coordinators:duration: 1:relations:- :to: :modelling_and_coordinating_penultimate_cycle@@ -1202,8 +1172,7 @@ projects:and "Request", thus represents a general note.:status: default_status_new:type: default_type_milestone- # TODO: ref wont be found with another language- :assigned_to: BIM Coordinators+ :assigned_to: :group__bim_coordinators:duration: 1:relations:- :to: :modelling_and_coordinating_last_cycle@@ -1230,8 +1199,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: BIM Coordinators+ :assigned_to: :group__bim_coordinators:duration: 5- :start: 98:t_subject: Construct the building@@ -1249,8 +1217,7 @@ projects:* ...:status: default_status_new:type: default_type_task- # TODO: ref wont be found with another language- :assigned_to: BIM Coordinators+ :assigned_to: :group__bim_coordinators:duration: 101- :start: 200:t_subject: Finish construction@@ -1258,14 +1225,12 @@ projects::description: '':status: default_status_new:type: default_type_milestone- # TODO: ref wont be found with another language- :assigned_to: BIM Coordinators+ :assigned_to: :group__bim_coordinators:duration: 1:relations:- :to: :construct_building:type: follows- # TODO: ref wont be found with another language- :assigned_to: BIM Coordinators+ :assigned_to: :group__bim_coordinators:duration: 112:relations:- :to: :finishing_modelling_and_coordinating@@ -1276,8 +1241,7 @@ projects::description: '':status: default_status_new:type: default_type_phase- # TODO: ref wont be found with another language- :assigned_to: Planners+ :assigned_to: :group__planners:duration: 88- :start: 210:t_subject: Handover for Facility Management@@ -1296,8 +1260,7 @@ projects:* ...:status: default_status_new:type: default_type_milestone- # TODO: ref wont be found with another language- :assigned_to: Lead BIM Coordinators+ :assigned_to: :group__lead_bim_coordinators:duration: 1:relations:- :to: :finish_construction@@ -1472,82 +1435,82 @@ projects:work_packages:- :start: 77:bcf_issue_uuid: fbbf9ecf-5721-4bf1-a08c-aed50dc19353- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 3:parent: :issue_management_first_cycle- :start: 77:bcf_issue_uuid: f6271a32-acf5-49f8-a1b5-7c445f9158e5- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 3:parent: :issue_management_first_cycle- :start: 77:bcf_issue_uuid: f210a2cd-f1f7-4691-b986-2f94117caefe- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 3:parent: :issue_management_first_cycle- :start: 77:bcf_issue_uuid: feb97e6e-14fd-4c62-bbad-607f2bb4ebf5- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 3:parent: :issue_management_first_cycle- :start: 77:bcf_issue_uuid: 00efc0da-b4d5-4933-bcb6-e01513ee2bcc- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 3:parent: :issue_management_first_cycle- :start: 77:bcf_issue_uuid: f9e079a8-02f5-40f0-a08a-171f494ee130- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 3:parent: :issue_management_first_cycle- :start: 77:bcf_issue_uuid: f70417a8-174a-42ae-bf1e-a0b6457d0e6f- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 3:parent: :issue_management_first_cycle- :start: 77:bcf_issue_uuid: f55d0ec0-9a0f-4222-9926-cc5744888b02- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 4:parent: :issue_management_first_cycle- :start: 77:bcf_issue_uuid: fc560c06-51fc-44fa-81b4-e688be189c6a- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 3:parent: :issue_management_first_cycle- :start: 77:bcf_issue_uuid: fe2f9c1f-631b-4b37-91ea-833c4751725a- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 3:parent: :issue_management_first_cycle- :start: 77:bcf_issue_uuid: fc5099c0-bedb-4770-a576-0429a7733517- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 3:parent: :issue_management_first_cycle- :start: 77:bcf_issue_uuid: 010d9884-8c93-4551-b2bc-570faffe7082- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 3:parent: :issue_management_first_cycle- :start: 77:bcf_issue_uuid: febee8e1-1ad2-45e5-b08d-b4be92d25ad6- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 3:parent: :issue_management_first_cycle- :start: 77:bcf_issue_uuid: f4d71d45-5a2c-4dad-bcb1-8a4935f2ea69- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 3:parent: :issue_management_first_cycle- :start: 77:bcf_issue_uuid: fb9705ea-b32c-46ff-bb6f-d1d049494e05- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 4:parent: :issue_management_first_cycle- :start: 77:bcf_issue_uuid: fbe1d941-06ce-45f4-8ccb-ef48b8426f72- :assigned_to: BIM Modellers+ :assigned_to: :group__bim_modellers:duration: 3:parent: :issue_management_first_cycle- :start: 98diff --git a/modules/bim/lib/open_project/bim/patches/work_package_board_seeder_patch.rb b/modules/bim/lib/open_project/bim/patches/work_package_board_seeder_patch.rbindex 95d81b8da50..146bec0e455 100644--- a/modules/bim/lib/open_project/bim/patches/work_package_board_seeder_patch.rb+++ b/modules/bim/lib/open_project/bim/patches/work_package_board_seeder_patch.rb@@ -42,14 +42,12 @@ module OpenProject::Bim::Patches::WorkPackageBoardSeederPatchenddef seed_bcf_board_queries- status_names = ['New', 'In progress', 'Resolved', 'Closed']- statuses = Status.where(name: status_names).to_a-- if statuses.size < status_names.size- raise StandardError.new "Not all statuses needed for seeding a BCF board are present. Check that they get seeded."- end-- statuses.to_a.map do |status|+ statuses(+ 'default_status_new',+ 'default_status_in_progress',+ 'bim.default_status_resolved',+ 'default_status_closed'+ ).map do |status|Query.new_default(project:, user:).tap do |query|# Make it public so that new members can see it tooquery.public = truediff --git a/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb b/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rbindex a941a80546c..ac784dc77c3 100644--- a/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb+++ b/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb@@ -33,57 +33,89 @@ describe RootSeeder,'BIM edition',with_config: { edition: 'bim' },with_settings: { journal_aggregation_time_minutes: 0 } do- before_all do- RSpec::Mocks.with_temporary_scope do- # the mocking of settings and configuration is duplicated here because- # it's executed outside of an example context- with_config(edition: 'bim')- with_settings(journal_aggregation_time_minutes: 0)- described_class.new.seed_data!+ shared_examples 'creates BIM demo data' do+ it 'creates an admin user' do+ expect(User.not_builtin.where(admin: true).count).to eq 1end- end- it 'creates an admin user' do- expect(User.not_builtin.where(admin: true).count).to eq 1- end+ it 'creates the BIM demo data' do+ expect(Project.count).to eq 4+ expect(WorkPackage.count).to eq 76+ expect(Wiki.count).to eq 3+ expect(Query.count).to eq 29+ expect(Group.count).to eq 8+ expect(Type.count).to eq 7+ expect(Status.count).to eq 4+ expect(IssuePriority.count).to eq 4+ expect(Projects::Status.count).to eq 4+ expect(Bim::IfcModels::IfcModel.count).to eq 3+ expect(Grids::Overview.count).to eq 4+ expect(Boards::Grid.count).to eq 2+ end- it 'creates the BIM demo data' do- expect(Project.count).to eq 4- expect(WorkPackage.count).to eq 76- expect(Wiki.count).to eq 3- expect(Query.count).to eq 29- expect(Group.count).to eq 8- expect(Type.count).to eq 7- expect(Status.count).to eq 4- expect(IssuePriority.count).to eq 4- expect(Projects::Status.count).to eq 4- expect(Bim::IfcModels::IfcModel.count).to eq 3- expect(Grids::Overview.count).to eq 4- expect(Boards::Grid.count).to eq 2+ it 'creates follows and parent-child relations' do+ expect(Relation.follows.count).to eq 35+ expect(WorkPackage.where.not(parent: nil).count).to eq 55+ endend- it 'creates follows and parent-child relations' do- expect(Relation.follows.count).to eq 35- expect(WorkPackage.where.not(parent: nil).count).to eq 55- end+ describe 'demo data' do+ before_all do+ RSpec::Mocks.with_temporary_scope do+ # the mocking of settings and configuration is duplicated here because+ # it's executed outside of an example context+ with_config(edition: 'bim')+ with_settings(journal_aggregation_time_minutes: 0)++ described_class.new.seed_data!+ end+ end++ include_examples 'creates BIM demo data'++ include_examples 'no email deliveries'- it 'assigns work packages to groups' do- count_by_assignee =- WorkPackage- .joins(:assigned_to)- .group("array_to_string(ARRAY[type || ':', firstname, lastname], ' ')")- .count- .transform_keys!(&:squish)- expect(count_by_assignee).to eq(- "Group: Architects" => 1,- "Group: BIM Coordinators" => 11,- "Group: BIM Managers" => 2,- "Group: BIM Modellers" => 21,- "Group: Lead BIM Coordinators" => 8,- "Group: Planners" => 21,- "User: OpenProject Admin" => 12- )+ it 'assigns work packages to groups' do+ count_by_assignee =+ WorkPackage+ .joins(:assigned_to)+ .group("array_to_string(ARRAY[type || ':', firstname, lastname], ' ')")+ .count+ .transform_keys!(&:squish)+ expect(count_by_assignee).to eq(+ "Group: Architects" => 1,+ "Group: BIM Coordinators" => 11,+ "Group: BIM Managers" => 2,+ "Group: BIM Modellers" => 21,+ "Group: Lead BIM Coordinators" => 8,+ "Group: Planners" => 21,+ "User: OpenProject Admin" => 12+ )+ endend- include_examples 'no email deliveries'+ describe 'demo data translated in another language' do+ before_all do+ RSpec::Mocks.with_temporary_scope do+ # the mocking of settings and configuration is duplicated here because+ # it's executed outside of an example context+ with_config(edition: 'bim')+ with_settings(journal_aggregation_time_minutes: 0)++ # simulate a translation by changing the returned string on `I18n#t` calls+ allow(I18n).to receive(:t).and_wrap_original do |m, *args, **kw|+ original_translation = m.call(*args, **kw)+ "tr: #{original_translation}"+ end++ described_class.new.seed_data!+ end+ end++ include_examples 'creates BIM demo data'++ it 'has all Query.name translated' do+ expect(Query.pluck(:name)).to all(start_with('tr: '))+ end+ endenddiff --git a/spec/seeders/demo_data/group_seeder_spec.rb b/spec/seeders/demo_data/group_seeder_spec.rbnew file mode 100644index 00000000000..6dc742cda7f--- /dev/null+++ b/spec/seeders/demo_data/group_seeder_spec.rb@@ -0,0 +1,59 @@+# frozen_string_literal: true++#-- 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.+#++++require 'spec_helper'++RSpec.describe DemoData::GroupSeeder do+ subject(:seeder) { described_class.new(seed_data) }++ let(:seed_data) { SeedData.new(data_hash) }++ context 'with a group defined' do+ let(:data_hash) do+ YAML.load <<~SEEDING_DATA_YAML+ groups:+ - name: Architects+ reference: :architects+ SEEDING_DATA_YAML+ end++ it 'creates the corresponding group with the given name as lastname' do+ seeder.seed!+ created_group = Group.last+ expect(created_group).to have_attributes(lastname: 'Architects')+ end++ it 'references the group in the seed data' do+ seeder.seed!+ created_group = Group.last+ expect(seed_data.find_reference(:architects)).to eq(created_group)+ end+ end+enddiff --git a/spec/seeders/demo_data/work_package_seeder_spec.rb b/spec/seeders/demo_data/work_package_seeder_spec.rbindex 3793ed98c75..dd229e9309a 100644--- a/spec/seeders/demo_data/work_package_seeder_spec.rb+++ b/spec/seeders/demo_data/work_package_seeder_spec.rb@@ -310,11 +310,16 @@ describe DemoData::WorkPackageSeeder doenddescribe 'assigned_to' do+ let(:seed_data) do+ seed_data = SeedData.new('work_packages' => work_packages_data)+ seed_data.store_reference(:user_bernard, a_user)+ seed_data+ endlet(:a_user) { create(:user, lastname: 'Bernard') }let(:work_packages_data) do[work_package_data(subject: 'without assigned_to'),- work_package_data(subject: 'with assigned_to', assigned_to: a_user.lastname)+ work_package_data(subject: 'with assigned_to', assigned_to: :user_bernard)]end@@ -323,7 +328,7 @@ describe DemoData::WorkPackageSeeder doexpect(work_package.assigned_to).to eq(User.user.admin.last)end- it 'assigns work packages with assigned_to referencing the user lastname' do+ it 'assigns work packages with assigned_to referencing the user' dowork_package = WorkPackage.find_by(subject: 'with assigned_to')expect(work_package.assigned_to).to eq(a_user)end@@ -340,7 +345,7 @@ describe DemoData::WorkPackageSeeder dolet(:work_packages_data) do[work_package_data(bcf_issue_uuid: bcf_issue_without_assigned_to.uuid),- work_package_data(bcf_issue_uuid: bcf_issue_with_assigned_to.uuid, assigned_to: a_user.lastname)+ work_package_data(bcf_issue_uuid: bcf_issue_with_assigned_to.uuid, assigned_to: :user_bernard)]enddiff --git a/spec/seeders/seed_data_spec.rb b/spec/seeders/seed_data_spec.rbnew file mode 100644index 00000000000..6b1ccd92ced--- /dev/null+++ b/spec/seeders/seed_data_spec.rb@@ -0,0 +1,62 @@+# frozen_string_literal: true++#-- 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.+#++++require 'spec_helper'++RSpec.describe SeedData do+ subject(:seed_data) { described_class.new({}) }++ describe '#store_reference / find_reference' do+ it 'acts as a key store to register object by a symbol' do+ object = Object.new+ seed_data.store_reference(:ref, object)+ expect(seed_data.find_reference(:ref)).to be(object)+ end++ it 'stores nothing if reference is nil' do+ object = Object.new+ seed_data.store_reference(nil, object)+ seed_data.store_reference(nil, object)+ end++ it 'returns nil if reference is nil' do+ expect(seed_data.find_reference(nil)).to be_nil+ object = Object.new+ seed_data.store_reference(nil, object)+ expect(seed_data.find_reference(nil)).to be_nil+ end++ it 'raises an error when the reference is already used' do+ seed_data.store_reference(:ref, Object.new)+ expect { seed_data.store_reference(:ref, Object.new) }+ .to raise_error(ArgumentError)+ end+ end+end