Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[54354] Update seed data #15591

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/seeders/standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,21 @@ projects:
- to: :follow_up_tasks
type: follows
schedule_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 project
identifier: your-scrum-project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,28 @@ def initialize(_project, seed_data)

def 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"]
end
end
end
end
28 changes: 19 additions & 9 deletions modules/meeting/app/seeders/standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,50 +31,60 @@ projects:
meetings:
- reference: :weekly_meeting
t_title: Weekly
duration: 80
duration: 60
author: :openproject_admin
meeting_agenda_items:
- t_title: Good news
notes: "What went well this week?"
meeting: :weekly_meeting
author: :openproject_admin
presenter: :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
presenter: :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
presenter: :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
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_admin
duration: 5
- t_title: Updates from sales team
notes: "News and focused topics for the upcoming week."
meeting: :weekly_meeting
author: :openproject_admin
presenter: :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
presenter: :openproject_admin
duration: 5
- t_title: Core values feedback
notes: "Highlight employees who have lived the core values this week."
meeting: :weekly_meeting
author: :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_conference
author: :openproject_admin
duration: 30
presenter: :openproject_admin
duration: 20
Original file line number Diff line number Diff line change
@@ -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
end
4 changes: 2 additions & 2 deletions modules/meeting/spec/seeders/demo_data/project_seeder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@
expect(first.author).to eq user
expect(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_nil
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

it "uses default duration of 1h if not specified" do
Expand Down
7 changes: 7 additions & 0 deletions spec/seeders/root_seeder_standard_edition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@
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" do
count_by_type = View.group(:type).count
expect(count_by_type).to eq(
Expand Down
Loading