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
Create a StructuredMeeting seeder for the demo project
Oliver Günthere29138ade182
diff --git a/app/seeders/demo_data/project_seeder.rb b/app/seeders/demo_data/project_seeder.rbindex 5562036000b..4c597f8e734 100644--- a/app/seeders/demo_data/project_seeder.rb+++ b/app/seeders/demo_data/project_seeder.rb@@ -54,7 +54,9 @@ module DemoData[DemoData::WikiSeeder,DemoData::WorkPackageSeeder,- DemoData::WorkPackageBoardSeeder+ DemoData::WorkPackageBoardSeeder,+ ::Meetings::DemoData::MeetingSeeder,+ ::Meetings::DemoData::MeetingAgendaItemsSeeder,]enddiff --git a/app/seeders/standard.yml b/app/seeders/standard.ymlindex 9a8124998d2..3213631dd84 100644--- a/app/seeders/standard.yml+++ b/app/seeders/standard.yml@@ -261,6 +261,7 @@ projects:- wiki- board_view- team_planner_view+ - meetingsnews:- t_title: Welcome to your demo projectt_summary: |diff --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.rbnew file mode 100644index 00000000000..99be95acbda--- /dev/null+++ b/modules/meeting/app/seeders/meetings/demo_data/meeting_agenda_items_seeder.rb@@ -0,0 +1,53 @@+#-- 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 Meetings+ module DemoData+ class MeetingAgendaItemsSeeder < ::BasicData::ModelSeeder+ self.model_class = MeetingAgendaItem+ self.seed_data_model_key = 'meeting_agenda_items'++ ##+ #+ def initialize(_project, seed_data)+ super(seed_data)+ end++ def model_attributes(meeting_data)+ {+ title: meeting_data['title'],+ notes: meeting_data['notes'],+ duration_in_minutes: meeting_data['duration'],+ author: seed_data.find_reference(meeting_data['author']),+ meeting: seed_data.find_reference(meeting_data['meeting']),+ work_package: seed_data.find_reference(meeting_data['work_package'])+ }+ end+ end+ end+enddiff --git a/modules/meeting/app/seeders/meetings/demo_data/meeting_seeder.rb b/modules/meeting/app/seeders/meetings/demo_data/meeting_seeder.rbnew file mode 100644index 00000000000..0274f022d5d--- /dev/null+++ b/modules/meeting/app/seeders/meetings/demo_data/meeting_seeder.rb@@ -0,0 +1,51 @@+#-- 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 Meetings+ module DemoData+ class MeetingSeeder < ::BasicData::ModelSeeder+ self.model_class = StructuredMeeting+ self.seed_data_model_key = 'meetings'++ attr_reader :project++ def initialize(project, seed_data)+ super(seed_data)+ @project = project+ end++ def model_attributes(meeting_data)+ {+ title: meeting_data['title'],+ author: seed_data.find_reference(meeting_data['author']),+ project:+ }+ end+ end+ end+enddiff --git a/modules/meeting/app/seeders/standard.yml b/modules/meeting/app/seeders/standard.ymlnew file mode 100644index 00000000000..d36f965e3cc--- /dev/null+++ b/modules/meeting/app/seeders/standard.yml@@ -0,0 +1,80 @@+#-- 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.+#++++projects:+ demo-project:+ meetings:+ - reference: :weekly_meeting+ t_title: Weekly+ duration: 80+ author: :openproject_admin+ meeting_agenda_items:+ - t_title: Good news+ notes: "What went well this week?"+ meeting: :weekly_meeting+ author: :openproject_admin+ duration: 5+ - t_title: Updates from development team+ notes: "News and focused topics for the upcoming week."+ meeting: :weekly_meeting+ author: :openproject_admin+ duration: 5+ - t_title: Updates from product team+ notes: "News and focused topics for the upcoming week."+ meeting: :weekly_meeting+ author: :openproject_admin+ duration: 5+ - t_title: Updates from marketing team+ notes: "News and focused topics for the upcoming week."+ meeting: :weekly_meeting+ author: :openproject_admin+ duration: 5+ - t_title: Updates from sales team+ notes: "News and focused topics for the upcoming week."+ meeting: :weekly_meeting+ author: :openproject_admin+ duration: 5+ - t_title: Review of quarterly goals+ notes: "Assessing the status and progress of the defined quarterly goals."+ meeting: :weekly_meeting+ author: :openproject_admin+ duration: 12+ - t_title: Core values feedback+ notes: "Highlight employees who have lived the core values this week."+ meeting: :weekly_meeting+ author: :openproject_admin+ duration: 10+ - t_title: General topics+ notes: |+ Solving or discussing one topic together.++ **Today's topic**: Organizing the open-source conference+ meeting: :weekly_meeting+ work_package: :organize_open_source_conference+ author: :openproject_admin+ duration: 30diff --git a/modules/meeting/spec/seeders/demo_data/project_seeder_spec.rb b/modules/meeting/spec/seeders/demo_data/project_seeder_spec.rbnew file mode 100644index 00000000000..636093d0344--- /dev/null+++ b/modules/meeting/spec/seeders/demo_data/project_seeder_spec.rb@@ -0,0 +1,95 @@+# 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::ProjectSeeder do+ include_context 'with basic seed data'++ subject(:project_seeder) { described_class.new(seed_data.lookup('projects.my-project')) }++ let(:work_package) { create(:work_package) }+ let(:user) { create(:user) }+ let(:seed_data) do+ data = basic_seed_data.merge(+ Source::SeedData.new(+ 'projects' => {+ 'my-project' => project_data+ }+ )+ )++ data.store_reference(:openproject_user, user)+ data.store_reference(:work_package_foo, work_package)++ data+ end++ let(:project_data) do+ YAML.load <<~SEEDING_DATA_YAML+ name: 'Some project'+ meetings:+ - title: Weekly+ reference: :weekly_meeting+ author: :openproject_user+ meeting_agenda_items:+ - title: First topic+ meeting: :weekly_meeting+ duration: 10+ author: :openproject_user+ notes: Some **markdown**+ - title: Reference+ meeting: :weekly_meeting+ duration: 5+ author: :openproject_user+ notes: Some **markdown**+ work_package: :work_package_foo+ SEEDING_DATA_YAML+ end++ it 'creates an associated meeting' do+ project_seeder.seed!+ meeting = Meeting.find_by(title: 'Weekly')+ expect(meeting.author).to eq user++ expect(meeting.agenda_items.count).to eq 2++ first = meeting.agenda_items.find_by(title: 'First topic')+ expect(first.duration_in_minutes).to eq 10+ expect(first.author).to eq user+ expect(first.notes).to eq 'Some **markdown**'++ second = meeting.agenda_items.find_by(title: 'Reference')+ expect(second.duration_in_minutes).to eq 5+ expect(second.author).to eq user+ expect(second.notes).to eq 'Some **markdown**'+ expect(second.work_package).to eq work_package+ end+end