seeds.rb 1.56 KB
Newer Older
mafolz's avatar
mafolz committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# encoding: UTF-8
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
#   cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
#   Mayor.create(name: 'Emanuel', city: cities.first)

Quest.delete_all
Reward.delete_all

Quest.create({
  :title  => 'Küche aufgeräumt',
surma Lodur's avatar
surma Lodur committed
15
  :points => 50
mafolz's avatar
mafolz committed
16
17
18
19
20
})


Quest.create({
  :title  => 'Müll rausgebracht',
surma Lodur's avatar
surma Lodur committed
21
  :points => 1
mafolz's avatar
mafolz committed
22
23
24
25
26
})


Quest.create({
  :title  => 'Getränke gekauft',
surma Lodur's avatar
surma Lodur committed
27
  :points => 5
mafolz's avatar
mafolz committed
28
29
30
})

Reward.create({
Kim Meiser's avatar
Kim Meiser committed
31
  :title => 'Roter Artikel (Getränk)',
surma Lodur's avatar
surma Lodur committed
32
  :points => 15
mafolz's avatar
mafolz committed
33
34
35
})

Reward.create({
Kim Meiser's avatar
Kim Meiser committed
36
  :title => 'Gelber Artikel (Snack)',
surma Lodur's avatar
surma Lodur committed
37
  :points => 10
mafolz's avatar
mafolz committed
38
39
40
})

Reward.create({
Kim Meiser's avatar
Kim Meiser committed
41
  :title => 'Blauer Artikel (Mini-Snack)',
mafolz's avatar
mafolz committed
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
  :points => 5
})



require 'ffaker'

hacker = Hacker.first

1.upto(10) do
  Earning.create({
    :hacker => hacker,
    :user   => (rand(100) % 2) == 0 ? hacker : nil,
    :points => rand(100),
    :quest  => Quest.all.shuffle.first,
    :chronicle_text => Faker::Lorem.sentence
  })
end

1.upto(4) do
  Redemption.create({
    :hacker => hacker,
    :user   => (rand(100) % 2) == 0 ? hacker : nil,
    :points => rand(100),
    :reward  => Reward.all.shuffle.first,
    :chronicle_text => Faker::Lorem.sentence
  })
end

Cancel.create({
  :hacker => hacker,
  :subject => Earning.all.shuffle.first,
  :chronicle_text => Faker::Lorem.sentence
})



Cancel.create({
  :hacker => hacker,
  :subject => Redemption.all.shuffle.first,
  :chronicle_text => Faker::Lorem.sentence
})