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
[54354] Update seed data
Christophe Bliard44a4d1e74e25
diff --git a/app/seeders/standard.yml b/app/seeders/standard.ymlindex 94448e54fce..ff624a687ba 100644--- a/app/seeders/standard.yml+++ b/app/seeders/standard.yml@@ -551,6 +551,21 @@ projects:- to: :follow_up_taskstype: followsschedule_manually: false+ t_wiki: |+ _In this wiki you can collaboratively create and edit pages and sub-pages to create a project wiki._++ **You can:**++ * Insert text and images, also with copy and paste from other documents+ * Create a page hierarchy with parent pages+ * Include wiki pages to the project menu+ * Use macros to include, e.g. table of contents, work package lists, or Gantt charts+ * Include wiki pages in other text fields, e.g. project overview page+ * Include links to other documents+ * View the change history+ * View as Markdown++ More information: [https://www.openproject.org/docs/user-guide/wiki/](https://www.openproject.org/docs/user-guide/wiki/)scrum-project:t_name: Scrum projectidentifier: your-scrum-projectdiff --git a/modules/meeting/app/seeders/meetings/demo_data/meeting_agenda_items_seeder.rb b/modules/meeting/app/seeders/meetings/demo_data/meeting_agenda_items_seeder.rbindex 36227d6c825..385c64f2f18 100644--- a/modules/meeting/app/seeders/meetings/demo_data/meeting_agenda_items_seeder.rb+++ b/modules/meeting/app/seeders/meetings/demo_data/meeting_agenda_items_seeder.rb@@ -40,14 +40,28 @@ module Meetingsdef model_attributes(meeting_data){- title: meeting_data["title"],+ item_type: item_type(meeting_data),+ title: title(meeting_data),notes: meeting_data["notes"],duration_in_minutes: meeting_data["duration"],author: seed_data.find_reference(meeting_data["author"]),+ presenter: seed_data.find_reference(meeting_data["presenter"]),meeting: seed_data.find_reference(meeting_data["meeting"]),work_package: seed_data.find_reference(meeting_data["work_package"])}end++ def item_type(meeting_data)+ if meeting_data["work_package"]+ MeetingAgendaItem.item_types[:work_package]+ else+ MeetingAgendaItem.item_types[:simple]+ end+ end++ def title(meeting_data)+ meeting_data["title"] unless meeting_data["work_package"]+ endendendenddiff --git a/modules/meeting/app/seeders/standard.yml b/modules/meeting/app/seeders/standard.ymlindex 17783c5d632..75f83203b5f 100644--- a/modules/meeting/app/seeders/standard.yml+++ b/modules/meeting/app/seeders/standard.yml@@ -31,50 +31,60 @@ projects:meetings:- reference: :weekly_meetingt_title: Weekly- duration: 80+ duration: 60author: :openproject_adminmeeting_agenda_items:- t_title: Good newsnotes: "What went well this week?"meeting: :weekly_meetingauthor: :openproject_admin+ presenter: :openproject_adminduration: 5- t_title: Updates from development teamnotes: "News and focused topics for the upcoming week."meeting: :weekly_meetingauthor: :openproject_admin+ presenter: :openproject_adminduration: 5- t_title: Updates from product teamnotes: "News and focused topics for the upcoming week."meeting: :weekly_meetingauthor: :openproject_admin+ presenter: :openproject_adminduration: 5- t_title: Updates from marketing teamnotes: "News and focused topics for the upcoming week."meeting: :weekly_meetingauthor: :openproject_admin+ presenter: :openproject_admin+ duration: 5+ - work_package: :organize_open_source_conference+ notes: "**Today's topic**: Organizing the open-source conference."+ meeting: :weekly_meeting+ author: :openproject_admin+ presenter: :openproject_adminduration: 5- t_title: Updates from sales teamnotes: "News and focused topics for the upcoming week."meeting: :weekly_meetingauthor: :openproject_admin+ presenter: :openproject_adminduration: 5- t_title: Review of quarterly goalsnotes: "Assessing the status and progress of the defined quarterly goals."meeting: :weekly_meetingauthor: :openproject_admin- duration: 12+ presenter: :openproject_admin+ duration: 5- t_title: Core values feedbacknotes: "Highlight employees who have lived the core values this week."meeting: :weekly_meetingauthor: :openproject_admin- duration: 10+ presenter: :openproject_admin+ duration: 5- t_title: General topics- notes: |- Solving or discussing one topic together.-- **Today's topic**: Organizing the open-source conference+ notes: "Solving or discussing topics together."meeting: :weekly_meeting- work_package: :organize_open_source_conferenceauthor: :openproject_admin- duration: 30+ presenter: :openproject_admin+ duration: 20diff --git a/modules/meeting/spec/seeders/demo_data/meeting_agenda_items_seeder_spec.rb b/modules/meeting/spec/seeders/demo_data/meeting_agenda_items_seeder_spec.rbnew file mode 100644index 00000000000..671aeccaa44--- /dev/null+++ b/modules/meeting/spec/seeders/demo_data/meeting_agenda_items_seeder_spec.rb@@ -0,0 +1,103 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 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 Meetings::DemoData::MeetingAgendaItemsSeeder do+ include_context "with basic seed data"++ shared_let(:alice) { create(:user, firstname: "Alice") }+ shared_let(:bob) { create(:user, firstname: "Bob") }+ shared_let(:meeting) { create(:structured_meeting, title: "Weekly meeting") }+ shared_let(:work_package) { create(:work_package, subject: "Some important task") }++ subject(:seeder) { described_class.new("_project", seed_data) }++ let(:seed_data) do+ seed_data = basic_seed_data.merge(Source::SeedData.new(data_hash))+ seed_data.store_reference(:user_alice, alice)+ seed_data.store_reference(:user_bob, bob)+ seed_data.store_reference(:weekly_meeting, meeting)+ seed_data.store_reference(:work_package_some_important_task, work_package)+ seed_data+ end++ before do+ seeder.seed!+ end++ context "with some meeting agenda items defined" do+ let(:data_hash) do+ YAML.load <<~SEEDING_DATA_YAML+ meeting_agenda_items:+ - title: Good news+ notes: "What went well this week?"+ meeting: :weekly_meeting+ author: :user_alice+ duration: 5+ - work_package: :work_package_some_important_task+ title: "Important task"+ notes: "We should discuss this..."+ meeting: :weekly_meeting+ author: :user_bob+ presenter: :user_bob+ SEEDING_DATA_YAML+ end++ it "creates the corresponding statuses with the given attributes" do+ expect(MeetingAgendaItem.count).to eq(2)+ expect(MeetingAgendaItem.find_by(title: "Good news")).to have_attributes(+ notes: "What went well this week?",+ meeting:,+ author: alice,+ presenter: nil,+ duration_in_minutes: 5+ )+ expect(MeetingAgendaItem.find_by(work_package_id: work_package.id)).to have_attributes(+ notes: "We should discuss this...",+ meeting:,+ author: bob,+ presenter: bob,+ duration_in_minutes: nil+ )+ end++ it "sets item type to simple if title is set and work_package is not set" do+ expect(MeetingAgendaItem.find_by(title: "Good news")).to have_attributes(+ item_type: "simple"+ )+ end++ it "sets item type to work_package and set title to nil if work_package is set" do+ expect(MeetingAgendaItem.find_by(work_package_id: work_package.id)).to have_attributes(+ item_type: "work_package",+ title: nil+ )+ end+ end+enddiff --git a/modules/meeting/spec/seeders/demo_data/project_seeder_spec.rb b/modules/meeting/spec/seeders/demo_data/project_seeder_spec.rbindex 839e59efb4a..12b763b8e15 100644--- a/modules/meeting/spec/seeders/demo_data/project_seeder_spec.rb+++ b/modules/meeting/spec/seeders/demo_data/project_seeder_spec.rb@@ -93,11 +93,11 @@ RSpec.describe DemoData::ProjectSeeder doexpect(first.author).to eq userexpect(first.notes).to eq "Some **markdown**"- second = meeting.agenda_items.find_by(title: "Reference")+ second = meeting.agenda_items.find_by(work_package:)+ expect(second.title).to be_nilexpect(second.duration_in_minutes).to eq 5expect(second.author).to eq userexpect(second.notes).to eq "Some **markdown**"- expect(second.work_package).to eq work_packageendit "uses default duration of 1h if not specified" dodiff --git a/spec/seeders/root_seeder_standard_edition_spec.rb b/spec/seeders/root_seeder_standard_edition_spec.rbindex 2799ccf8e7e..bb5d5101e65 100644--- a/spec/seeders/root_seeder_standard_edition_spec.rb+++ b/spec/seeders/root_seeder_standard_edition_spec.rb@@ -82,6 +82,13 @@ RSpec.describe RootSeeder,expect(default_modules).to include("reporting_module")end+ it "creates a structured meeting of 1h duration" do+ expect(StructuredMeeting.count).to eq 1+ expect(StructuredMeeting.last.duration).to eq 1.0+ expect(MeetingAgendaItem.count).to eq 9+ expect(MeetingAgendaItem.sum(:duration_in_minutes)).to eq 60+ end+it "creates different types of queries" docount_by_type = View.group(:type).countexpect(count_by_type).to eq(