Skip to content

Commit

Permalink
Merge pull request #13776 from opf/fix/use_meeting_duration_from_seed…
Browse files Browse the repository at this point in the history
…_data

Use meeting duration from seed data
  • Loading branch information
oliverguenther authored Sep 25, 2023
2 parents 16c4eec + 595ca66 commit 6345eac
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@ def model_attributes(meeting_data)
{
title: meeting_data['title'],
author: seed_data.find_reference(meeting_data['author']),
duration: minutes_to_hours(meeting_data['duration']),
project:
}
end

def minutes_to_hours(duration)
duration && (duration / 60.0)
end
end
end
end
14 changes: 13 additions & 1 deletion modules/meeting/spec/seeders/demo_data/project_seeder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
meetings:
- title: Weekly
reference: :weekly_meeting
duration: 30
author: :openproject_user
- title: Implicit 1h duration
author: :openproject_user
meeting_agenda_items:
- title: First topic
Expand All @@ -74,10 +77,14 @@
SEEDING_DATA_YAML
end

it 'creates an associated meeting' do
before do
project_seeder.seed!
end

it 'creates an associated meeting' do
meeting = Meeting.find_by(title: 'Weekly')
expect(meeting.author).to eq user
expect(meeting.duration).to eq 0.5

expect(meeting.agenda_items.count).to eq 2

Expand All @@ -92,4 +99,9 @@
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
meeting = Meeting.find_by(title: 'Implicit 1h duration')
expect(meeting.duration).to eq 1
end
end
1 change: 1 addition & 0 deletions spec/seeders/root_seeder_standard_edition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
include_examples 'it creates records', model: Status, expected_count: 14
include_examples 'it creates records', model: TimeEntryActivity, expected_count: 6
include_examples 'it creates records', model: Workflow, expected_count: 1172
include_examples 'it creates records', model: Meeting, expected_count: 1
end

describe 'demo data' do
Expand Down

0 comments on commit 6345eac

Please sign in to comment.