blob: 956b9562cacf9f759c2e2a1f7940ce7f4efe8fa1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
|
# coding: 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)
stif = Organisation.find_or_create_by!(name: "STIF") do |org|
org.code = 'STIF'
end
stif.users.find_or_create_by!(username: "admin") do |user|
user.email = 'stif-boiv@af83.com'
user.password = "secret"
user.name = "STIF Administrateur"
end
OfferWorkbench.find_or_create_by(name: "Gestion de l'offre", organisation: stif)
operator = Organisation.find_or_create_by(code: 'transporteur-a') do |organisation|
operator.name = "Transporteur A"
end
operator.users.find_or_create_by!(username: "transporteur") do |user|
user.email = 'stif-boiv+transporteur@af83.com'
user.password = "secret"
user.name = "Martin Lejeune"
end
stop_area_referential = StopAreaReferential.find_or_create_by(name: "Reflex") do |referential|
referential.add_member stif, owner: true
referential.add_member operator
end
10.times do |n|
stop_area_referential.stop_areas.find_or_create_by name: "Test #{n}", area_type: "Quay"
end
line_referential = LineReferential.find_or_create_by(name: "CodifLigne") do |referential|
referential.add_member stif, owner: true
referential.add_member operator
end
LineReferentialSync.find_or_create_by(line_referential: line_referential)
StopAreaReferentialSync.find_or_create_by(stop_area_referential: stop_area_referential)
10.times do |n|
line_referential.lines.find_or_create_by name: "Test #{n}" do |l|
l.objectid = "Chouette:Dummy:Line:00" + n.to_s
end
end
offer_workbench = OfferWorkbench.find_or_create_by(name: "Gestion de l'offre", organisation: operator)
[["parissudest201604", "Paris Sud-Est Avril 2016"],
["parissudest201605", "Paris Sud-Est Mai 2016"]].each do |slug, name|
operator.referentials.find_or_create_by!(slug: slug) do |referential|
referential.name = name
referential.prefix = slug
referential.offer_workbench = offer_workbench
referential.line_referential = line_referential
referential.stop_area_referential = stop_area_referential
end
end
|