-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfalconiformes.rb
More file actions
178 lines (174 loc) · 5.03 KB
/
falconiformes.rb
File metadata and controls
178 lines (174 loc) · 5.03 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
shared_context 'Falconiformes' do
before(:all) do
@order = create_cites_eu_order(
taxon_name: create(:taxon_name, scientific_name: 'Falconiformes'),
parent: cites_eu_aves
)
@family1 = create_cites_eu_family(
taxon_name: create(:taxon_name, scientific_name: 'Cathartidae'),
parent: @order
)
@genus1_1 = create_cites_eu_genus(
taxon_name: create(:taxon_name, scientific_name: 'Gymnogyps'),
parent: @family1
)
@species1_1 = create_cites_eu_species(
taxon_name: create(:taxon_name, scientific_name: 'Californianus'),
parent: @genus1_1,
name_status: 'A'
)
@genus1_2 = create_cites_eu_genus(
taxon_name: create(:taxon_name, scientific_name: 'Sarcoramphus'),
parent: @family1
)
@species1_2 = create_cites_eu_species(
taxon_name: create(:taxon_name, scientific_name: 'Papa'),
parent: @genus1_2,
name_status: 'A'
)
@genus1_3 = create_cites_eu_genus(
taxon_name: create(:taxon_name, scientific_name: 'Vultur'),
parent: @family1
)
# this one is not listed
@species1_3 = create_cites_eu_species(
taxon_name: create(:taxon_name, scientific_name: 'Atratus'),
parent: @genus1_3,
name_status: 'A'
)
@family2 = create_cites_eu_family(
taxon_name: create(:taxon_name, scientific_name: 'Falconidae'),
parent: @order
)
@genus2_1 = create_cites_eu_genus(
taxon_name: create(:taxon_name, scientific_name: 'Falco'),
parent: @family2
)
@species2_1 = create_cites_eu_species(
taxon_name: create(:taxon_name, scientific_name: 'Araeus'),
parent: @genus2_1,
name_status: 'A'
)
@species2_2 = create_cites_eu_species(
taxon_name: create(:taxon_name, scientific_name: 'Alopex'),
parent: @genus2_1,
name_status: 'A'
)
@species2_3 = create_cites_eu_species(
taxon_name: create(:taxon_name, scientific_name: 'peregrinus'),
parent: @genus2_1,
name_status: 'A'
)
@subspecies2_3_1 = create_cites_eu_subspecies(
taxon_name: create(:taxon_name, scientific_name: 'peregrinus'),
parent: @species2_3,
name_status: 'A'
)
@hybrid = create_cites_eu_genus(
taxon_name: create(:taxon_name, scientific_name: 'Falco hybrid'),
parent: nil,
name_status: 'H'
)
cites_lc1 = create_cites_II_addition(
taxon_concept: @order,
effective_at: '1979-06-28',
is_current: true
)
create_cites_II_exception(
taxon_concept: @family1,
effective_at: '1979-06-28',
parent_id: cites_lc1.id
)
create_cites_I_addition(
taxon_concept: @species1_1,
effective_at: '1975-07-01',
is_current: true
)
create_cites_III_addition(
taxon_concept: @species1_2,
effective_at: '1987-04-13',
is_current: true
)
create_cites_II_addition(
taxon_concept: @family2,
effective_at: '1975-07-01'
)
create_cites_II_addition(
taxon_concept: @family2,
effective_at: '1979-06-28',
inclusion_taxon_concept_id: @order.id,
is_current: true
)
create_cites_II_addition(
taxon_concept: @species2_1,
effective_at: '1975-07-01'
)
create_cites_I_addition(
taxon_concept: @species2_1,
effective_at: '1977-02-04',
is_current: true
)
create_cites_I_addition(
taxon_concept: @species2_3,
effective_at: '1977-02-04',
is_current: true
)
create_cites_I_addition(
taxon_concept: @subspecies2_3_1,
effective_at: '1977-02-04',
inclusion_taxon_concept_id: @species2_3.id,
is_current: true
)
eu_lc1 = create_eu_B_addition(
taxon_concept: @order,
effective_at: '2013-08-10',
event: reg2013,
is_current: true
)
create_eu_B_exception(
taxon_concept: @family1,
effective_at: '2013-08-10',
parent_id: eu_lc1.id
)
create_eu_A_addition(
taxon_concept: @species1_1,
effective_at: '2013-08-10',
event: reg2013,
is_current: true
)
create_eu_C_addition(
taxon_concept: @species1_2,
effective_at: '2013-08-10',
event: reg2013,
is_current: true
)
create_eu_A_addition(
taxon_concept: @species2_1,
effective_at: '2013-08-10',
event: reg2013,
is_current: true
)
create_eu_A_addition(
taxon_concept: @species2_3,
effective_at: '2013-08-10',
event: reg2013,
is_current: true
)
SapiModule::StoredProcedures.rebuild_cites_taxonomy_and_listings
self.instance_variables.each do |t|
# Skip old sapi context let statements,
# which are now instance variables starting with _
next if t.to_s.include?('@_')
var = self.instance_variable_get(t)
if var.kind_of? TaxonConcept
self.instance_variable_set(t, MTaxonConcept.find(var.id))
self.instance_variable_get(t).reload
self.instance_variable_set(
:"#{t}_ac",
MAutoCompleteTaxonConcept.
where(id: var.id).first
)
end
end
end
end