Adopt BIM seeder to user new "BCF issue associated" filter

pull/7348/head
Wieland Lindenthal 5 years ago
parent 32a5a1f28f
commit f20ed10b16
  1. 3
      modules/bim_seeder/app/seeders/bim_seeder/basic_data/type_seeder.rb
  2. 63
      modules/bim_seeder/config/locales/en.seeders.bim.yml
  3. 1
      modules/bim_seeder/lib/open_project/bim_seeder/engine.rb
  4. 53
      modules/bim_seeder/lib/open_project/bim_seeder/patches/query_builder_patch.rb
  5. 4
      modules/bim_seeder/spec/seeders/demo_data_seeder_spec.rb

@ -42,8 +42,7 @@ module BimSeeder
phase: [3, true, :default_color_blue_dark, false, false, :default_type_phase],
building_model: [4, true, :default_color_blue, true, false, 'seeders.bim.default_type_building_model'],
defect: [5, true, :default_color_red, true, false, 'seeders.bim.default_type_defect'],
approval: [6, true, :default_color_grey_dark, true, false, 'seeders.bim.default_type_approval'],
bcf_issue: [6, true, :default_color_grey_red, true, false, 'seeders.bim.default_type_bcf_issue']
approval: [6, true, :default_color_grey_dark, true, false, 'seeders.bim.default_type_approval']
}
end
end

@ -31,7 +31,6 @@ en:
default_type_building_model: Building model
default_type_defect: Defect
default_type_approval: Approval
default_type_bcf_issue: Issue [BCF]
demo_data:
welcome:
title: "Welcome to OpenProject BIM Edition!"
@ -58,7 +57,6 @@ en:
- work_package_tracking
- news
- wiki
- bcf
news:
- title: Welcome to your demo project
summary: >
@ -72,7 +70,6 @@ en:
- 'seeders.bim.default_type_building_model'
- 'seeders.bim.default_type_defect'
- 'seeders.bim.default_type_approval'
- 'seeders.bim.default_type_bcf_issue'
categories:
- Category 1 (to be changed in Project settings)
queries:
@ -108,9 +105,6 @@ en:
- type
- status
- assigned_to
- name: Issues [BCF]
status: open
type: 'seeders.bim.default_type_bcf_issue'
work_packages:
- subject: Project kick-off
description: Plan and execute the project kick-off.
@ -389,3 +383,60 @@ en:
children:
- title: Project manual
content: ''
bcf-project:
name: Demo BCF project
identifier: demo-bcf-project
description: >
**This is a demo project for BCF**. You can edit the description in
the [Project settings -> Description](%{base_url}/projects/demo-bcf-project/settings).
timeline:
name: Timeline
modules:
- work_package_tracking
- bcf
types:
- :default_type_task
- :default_type_milestone
- :default_type_phase
- 'seeders.bim.default_type_building_model'
- 'seeders.bim.default_type_defect'
- 'seeders.bim.default_type_approval'
categories:
- Category 1 (to be changed in Project settings)
queries:
- name: All BCF issues
status: open
bcf_issue_associated: true
- name: Defects
status: open
type: 'seeders.bim.default_type_defect'
- name: Project plan
status: open
timeline: true
sort_by: id
hierarchy: true
- name: Milestones
status: open
type: :default_type_milestone
timeline: true
columns:
- id
- type
- status
- subject
- start_date
- due_date
sort_by: id
- name: Tasks
status: open
type: :default_type_task
hierarchy: true
sort_by: id
columns:
- id
- subject
- priority
- type
- status
- assigned_to
work_packages: []

@ -13,5 +13,6 @@ module OpenProject::BimSeeder
:requires_openproject => '>= 9.0.0'
patches [:RootSeeder]
patch_with_namespace :DemoData, :QueryBuilder
end
end

@ -0,0 +1,53 @@
#-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
#
# 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 doc/COPYRIGHT.rdoc for more details.
module OpenProject::BimSeeder::Patches::QueryBuilderPatch
def self.included(base) # :nodoc:
base.prepend InstanceMethods
end
module InstanceMethods
private
def filters
filters = super
set_bcf_issue_associated_filter!(filters)
filters
end
def set_bcf_issue_associated_filter!(filters)
if value = config[:bcf_issue_associated].presence
filters[:bcf_issue_associated] = {
operator: "=",
values: [value ? 't' : 'f']
}
end
end
end
end

@ -56,10 +56,10 @@ describe 'seeds' do
expect { DemoDataSeeder.new.seed! }.not_to raise_error
expect(User.where(admin: true).count).to eq 1
expect(Project.count).to eq 1
expect(Project.count).to eq 2
expect(WorkPackage.count).to eq 18
expect(Wiki.count).to eq 1
expect(Query.count).to eq 5
expect(Query.count).to eq 9
ensure
ActionMailer::Base.perform_deliveries = perform_deliveries
end

Loading…
Cancel
Save