Commit 36dbac2fd90c12a74781c9982db8f18bae938265

Authored by randx
1 parent e4cf99db

More seeds

app/views/milestones/_milestone.html.haml
... ... @@ -9,13 +9,14 @@
9 9 %small
10 10 = milestone.expires_at
11 11 .row
12   - .progress.progress-info.span4
13   - .bar{style: "width: #{milestone.percent_complete}%;"}
  12 + .span4
  13 + .progress.progress-info
  14 + .bar{style: "width: #{milestone.percent_complete}%;"}
14 15 .span6
15   - - if milestone.issues.any?
16   - = link_to project_issues_path(milestone.project, milestone_id: milestone.id) do
17   - = pluralize milestone.issues.count, 'Issue'
  16 + = link_to project_issues_path(milestone.project, milestone_id: milestone.id) do
  17 + = pluralize milestone.issues.count, 'Issue'
18 18  
19   - - if milestone.merge_requests.any?
20   - = link_to project_merge_requests_path(milestone.project, milestone_id: milestone.id) do
21   - = pluralize milestone.merge_requests.count, 'Merge Request'
  19 + = link_to project_merge_requests_path(milestone.project, milestone_id: milestone.id) do
  20 + = pluralize milestone.merge_requests.count, 'Merge Request'
  21 +  
  22 + %span.light #{milestone.percent_complete}% complete
... ...
db/fixtures/development/005_issues.rb
... ... @@ -1,40 +0,0 @@
1   -Issue.seed(:id, [
2   - { :id => 1, :project_id => 1, :author_id => 1, :assignee_id => 1, :title => Faker::Lorem.sentence(6) },
3   - { :id => 2, :project_id => 1, :author_id => 2, :assignee_id => 2, :title => Faker::Lorem.sentence(6) },
4   - { :id => 3, :project_id => 1, :author_id => 3, :assignee_id => 3, :title => Faker::Lorem.sentence(6) },
5   - { :id => 4, :project_id => 1, :author_id => 4, :assignee_id => 4, :title => Faker::Lorem.sentence(6) },
6   - { :id => 5, :project_id => 1, :author_id => 5, :assignee_id => 5, :title => Faker::Lorem.sentence(6) },
7   -
8   - { :id => 6, :project_id => 2, :author_id => 1, :assignee_id => 1, :title => Faker::Lorem.sentence(6) },
9   - { :id => 7, :project_id => 2, :author_id => 2, :assignee_id => 2, :title => Faker::Lorem.sentence(6) },
10   - { :id => 8, :project_id => 2, :author_id => 3, :assignee_id => 3, :title => Faker::Lorem.sentence(6) },
11   - { :id => 9, :project_id => 2, :author_id => 4, :assignee_id => 4, :title => Faker::Lorem.sentence(6) },
12   - { :id => 11, :project_id => 2, :author_id => 5, :assignee_id => 5, :title => Faker::Lorem.sentence(6) },
13   -
14   - { :id => 12, :project_id => 3, :author_id => 1, :assignee_id => 1, :title => Faker::Lorem.sentence(6)},
15   - { :id => 13, :project_id => 3, :author_id => 2, :assignee_id => 2, :title => Faker::Lorem.sentence(6)},
16   - { :id => 14, :project_id => 3, :author_id => 3, :assignee_id => 3, :title => Faker::Lorem.sentence(6)},
17   - { :id => 15, :project_id => 3, :author_id => 4, :assignee_id => 4, :title => Faker::Lorem.sentence(6)},
18   - { :id => 16, :project_id => 3, :author_id => 5, :assignee_id => 5, :title => Faker::Lorem.sentence(6)},
19   -
20   - { :id => 21, :project_id => 1, :author_id => 1, :assignee_id => 1, :title => Faker::Lorem.sentence(6) },
21   - { :id => 22, :project_id => 1, :author_id => 2, :assignee_id => 2, :title => Faker::Lorem.sentence(6) },
22   - { :id => 23, :project_id => 1, :author_id => 3, :assignee_id => 3, :title => Faker::Lorem.sentence(6) },
23   - { :id => 24, :project_id => 1, :author_id => 4, :assignee_id => 4, :title => Faker::Lorem.sentence(6) },
24   - { :id => 25, :project_id => 1, :author_id => 5, :assignee_id => 5, :title => Faker::Lorem.sentence(6) },
25   -
26   - { :id => 26, :project_id => 2, :author_id => 1, :assignee_id => 1, :title => Faker::Lorem.sentence(6) },
27   - { :id => 27, :project_id => 2, :author_id => 2, :assignee_id => 2, :title => Faker::Lorem.sentence(6) },
28   - { :id => 28, :project_id => 2, :author_id => 3, :assignee_id => 3, :title => Faker::Lorem.sentence(6) },
29   - { :id => 29, :project_id => 2, :author_id => 4, :assignee_id => 4, :title => Faker::Lorem.sentence(6) },
30   - { :id => 30, :project_id => 2, :author_id => 5, :assignee_id => 5, :title => Faker::Lorem.sentence(6) },
31   -
32   - { :id => 32, :project_id => 3, :author_id => 1, :assignee_id => 1, :title => Faker::Lorem.sentence(6)},
33   - { :id => 33, :project_id => 3, :author_id => 2, :assignee_id => 2, :title => Faker::Lorem.sentence(6)},
34   - { :id => 34, :project_id => 3, :author_id => 3, :assignee_id => 3, :title => Faker::Lorem.sentence(6)},
35   - { :id => 35, :project_id => 3, :author_id => 4, :assignee_id => 4, :title => Faker::Lorem.sentence(6)},
36   - { :id => 36, :project_id => 3, :author_id => 5, :assignee_id => 5, :title => Faker::Lorem.sentence(6)}
37   -])
38   -
39   -
40   -
db/fixtures/development/005_milestones.rb 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +Milestone.seed(:id, [
  2 + { :id => 1, :project_id => 1, :title => 'v' + Faker::Address.zip_code },
  3 + { :id => 2, :project_id => 1, :title => 'v' + Faker::Address.zip_code },
  4 + { :id => 3, :project_id => 1, :title => 'v' + Faker::Address.zip_code },
  5 + { :id => 4, :project_id => 2, :title => 'v' + Faker::Address.zip_code },
  6 + { :id => 5, :project_id => 2, :title => 'v' + Faker::Address.zip_code },
  7 +
  8 + { :id => 6, :project_id => 2, :title => 'v' + Faker::Address.zip_code },
  9 + { :id => 7, :project_id => 2, :title => 'v' + Faker::Address.zip_code },
  10 + { :id => 8, :project_id => 3, :title => 'v' + Faker::Address.zip_code },
  11 + { :id => 9, :project_id => 3, :title => 'v' + Faker::Address.zip_code },
  12 + { :id => 11, :project_id => 3, :title => 'v' + Faker::Address.zip_code },
  13 +])
... ...
db/fixtures/development/007_issues.rb 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +(1..300).each do |i|
  2 + # Random Project
  3 + project_id = rand(2) + 1
  4 + project = Project.find(project_id)
  5 +
  6 + # Random user
  7 + user = project.users.sample
  8 + user_id = user.id
  9 + IssueObserver.current_user = user
  10 +
  11 + Issue.seed(:id, [{
  12 + id: i,
  13 + project_id: project_id,
  14 + author_id: user_id,
  15 + assignee_id: user_id,
  16 + closed: [true, false].sample,
  17 + milestone: project.milestones.sample,
  18 + title: Faker::Lorem.sentence(6)
  19 + }])
  20 +end
... ...
db/fixtures/development/007_milestones.rb
... ... @@ -1,13 +0,0 @@
1   -Milestone.seed(:id, [
2   - { :id => 1, :project_id => 1, :title => 'v' + Faker::Address.zip_code },
3   - { :id => 2, :project_id => 1, :title => 'v' + Faker::Address.zip_code },
4   - { :id => 3, :project_id => 1, :title => 'v' + Faker::Address.zip_code },
5   - { :id => 4, :project_id => 2, :title => 'v' + Faker::Address.zip_code },
6   - { :id => 5, :project_id => 2, :title => 'v' + Faker::Address.zip_code },
7   -
8   - { :id => 6, :project_id => 2, :title => 'v' + Faker::Address.zip_code },
9   - { :id => 7, :project_id => 2, :title => 'v' + Faker::Address.zip_code },
10   - { :id => 8, :project_id => 3, :title => 'v' + Faker::Address.zip_code },
11   - { :id => 9, :project_id => 3, :title => 'v' + Faker::Address.zip_code },
12   - { :id => 11, :project_id => 3, :title => 'v' + Faker::Address.zip_code },
13   -])
db/fixtures/development/008_merge_requests.rb
1   -MergeRequest.seed(:id, [
2   - { :id => 1, milestone_id: 1, project_id: 1, source_branch: 'master', target_branch: 'feature', author_id: 1, assignee_id: 1, title: Faker::Lorem.sentence(6) },
3   - { :id => 2, milestone_id: 1, project_id: 1, source_branch: 'master', target_branch: 'feature', author_id: 2, assignee_id: 2, title: Faker::Lorem.sentence(6) },
4   - { :id => 3, milestone_id: 1, project_id: 1, source_branch: 'master', target_branch: 'feature', author_id: 3, assignee_id: 3, title: Faker::Lorem.sentence(6) },
5   - { :id => 4, milestone_id: 1, project_id: 1, source_branch: 'master', target_branch: 'feature', author_id: 4, assignee_id: 4, title: Faker::Lorem.sentence(6) },
6   - { :id => 5, milestone_id: 1, project_id: 1, source_branch: 'master', target_branch: 'feature', author_id: 5, assignee_id: 5, title: Faker::Lorem.sentence(6) },
  1 +(1..300).each do |i|
  2 + # Random Project
  3 + project_id = rand(2) + 1
  4 + project = Project.find(project_id)
7 5  
8   - { :id => 6, milestone_id: 5, project_id: 2, source_branch: 'master', target_branch: 'feature', author_id: 1, assignee_id: 1, title: Faker::Lorem.sentence(6) },
9   - { :id => 7, milestone_id: 6, project_id: 2, source_branch: 'master', target_branch: 'feature', author_id: 2, assignee_id: 2, title: Faker::Lorem.sentence(6) },
10   - { :id => 8, milestone_id: 6, project_id: 2, source_branch: 'master', target_branch: 'feature', author_id: 3, assignee_id: 3, title: Faker::Lorem.sentence(6) },
11   - { :id => 9, milestone_id: 6, project_id: 2, source_branch: 'master', target_branch: 'feature', author_id: 4, assignee_id: 4, title: Faker::Lorem.sentence(6) },
12   - { :id => 11, milestone_id: 5, project_id: 2, source_branch: 'master', target_branch: 'feature', author_id: 5, assignee_id: 5, title: Faker::Lorem.sentence(6) },
  6 + # Random user
  7 + user = project.users.sample
  8 + user_id = user.id
  9 + MergeRequestObserver.current_user = user
13 10  
14   - { :id => 12, milestone_id: 9, project_id: 3, source_branch: 'master', target_branch: 'feature', author_id: 1, assignee_id: 1, title: Faker::Lorem.sentence(6)},
15   - { :id => 13, milestone_id: 9, project_id: 3, source_branch: 'master', target_branch: 'feature', author_id: 2, assignee_id: 2, title: Faker::Lorem.sentence(6)},
16   - { :id => 14, milestone_id: 9, project_id: 3, source_branch: 'master', target_branch: 'feature', author_id: 3, assignee_id: 3, title: Faker::Lorem.sentence(6)},
17   - { :id => 15, milestone_id: 9, project_id: 3, source_branch: 'master', target_branch: 'feature', author_id: 4, assignee_id: 4, title: Faker::Lorem.sentence(6)},
18   - { :id => 16, milestone_id: 9, project_id: 3, source_branch: 'master', target_branch: 'feature', author_id: 5, assignee_id: 5, title: Faker::Lorem.sentence(6)},
19   -])
  11 + MergeRequest.seed(:id, [{
  12 + id: i,
  13 + source_branch: 'master',
  14 + target_branch: 'feature',
  15 + project_id: project_id,
  16 + author_id: user_id,
  17 + assignee_id: user_id,
  18 + closed: [true, false].sample,
  19 + milestone: project.milestones.sample,
  20 + title: Faker::Lorem.sentence(6)
  21 + }])
  22 +end
... ...