eve_app 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/concerns/eve_app/activity_relation.rb +14 -12
- data/app/models/eve_app/activity_material.rb +1 -1
- data/app/models/eve_app/activity_product.rb +5 -5
- data/app/models/eve_app/type.rb +5 -1
- data/lib/eve_app/sde/normalizer.rb +2 -0
- data/lib/eve_app/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb760ef4fecf0ffb483d49c1615320b78dce3cb0
|
4
|
+
data.tar.gz: 72a2ab7abd782b83878bdf929fd2d1e52601db0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ed8aef9695d7a58e8a2738dc842b0be74249d7250f2a71b93749cce2ee98ca355de54d79971dc5809e7cc3713d83675f5e579489e233cbb203b90294d46b739
|
7
|
+
data.tar.gz: a4e3bdb9756829f3e80772e277c7a41f5947863d38a7944a537994916eebf77f893cebc9fc981a3a79f2fa7ad916baa1ae23cf18738d7e10eca1e7222fcebd8a
|
@@ -5,22 +5,24 @@ module EveApp::ActivityRelation
|
|
5
5
|
belongs_to :type
|
6
6
|
belongs_to :activity
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
}
|
8
|
+
EveApp::Activity::TYPE_MAP.each do |id, type|
|
9
|
+
scope type, -> { where(activity_id: id) }
|
10
|
+
end
|
11
|
+
end
|
13
12
|
|
13
|
+
# included do
|
14
|
+
# scope :invention, -> { where(activity_id: EveApp::Activity::INVENTION) }
|
15
|
+
# scope :for, -> (tid, aid) { where(type_id: tid, activity_id: aid) }
|
14
16
|
# ????
|
15
17
|
# def activity_activity
|
16
18
|
# EveApp::Activity.where(type_id: type_id, activity_id: activity_id)
|
17
19
|
# end
|
18
|
-
end
|
20
|
+
# end
|
19
21
|
|
20
|
-
class_methods do
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
22
|
+
# class_methods do
|
23
|
+
# def type_name
|
24
|
+
# reflections = self.reflect_on_all_associations(:belongs_to)
|
25
|
+
# reflections.select { |r| r.options[:class_name] == 'Type' && r.name != :type }.first.name
|
26
|
+
# end
|
27
|
+
# end
|
26
28
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class EveApp::ActivityMaterial < EveApp::ApplicationRecord
|
2
2
|
include EveApp::ActivityRelation
|
3
3
|
|
4
|
-
belongs_to :
|
4
|
+
belongs_to :material_type, class_name: 'EveApp::Type', foreign_key: :material_type_id
|
5
5
|
|
6
6
|
scope :order_by_quantity, -> { order(quantity: :desc) }
|
7
7
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class EveApp::ActivityProduct < EveApp::ApplicationRecord
|
2
|
-
|
2
|
+
belongs_to :type
|
3
|
+
belongs_to :product_type, class_name: 'EveApp::Type', foreign_key: :product_type_id
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
scope :manufacture, -> { where(activity_id: EveApp::Activity::MANUFACTURE) }
|
5
|
+
EveApp::Activity::TYPE_MAP.each do |id, type|
|
6
|
+
scope type, -> { where(activity_id: id) }
|
7
|
+
end
|
8
8
|
end
|
data/app/models/eve_app/type.rb
CHANGED
@@ -3,8 +3,12 @@ class EveApp::Type < EveApp::ApplicationRecord
|
|
3
3
|
belongs_to :group
|
4
4
|
belongs_to :market_group
|
5
5
|
belongs_to :market_group_root, class_name: 'EveApp::MarketGroup'
|
6
|
+
belongs_to :blueprint_type, class_name: 'EveApp::Type', optional: true
|
6
7
|
|
7
|
-
|
8
|
+
has_one :manufacture_product, -> { manufacture }, class_name: 'EveApp::ActivityProduct'
|
9
|
+
has_one :manufacture_product_type, through: :manufacture_product, source: :product_type
|
10
|
+
|
11
|
+
has_many :activity_materials
|
8
12
|
|
9
13
|
scope :published, -> { where(published: true) }
|
10
14
|
|
@@ -52,10 +52,12 @@ module EveApp
|
|
52
52
|
sql %Q(ALTER TABLE #{table_list['invTypes']} ADD IF NOT EXISTS market_group_name character varying)
|
53
53
|
sql %Q(ALTER TABLE #{table_list['invMarketGroups']} ADD root_group_id INTEGER DEFAULT NULL)
|
54
54
|
sql %Q(ALTER TABLE #{table_list['invTypes']} ADD market_group_root_id integer)
|
55
|
+
sql %Q(ALTER TABLE #{table_list['invTypes']} ADD blueprint_type_id integer)
|
55
56
|
sql %Q(UPDATE #{table_list['invTypes']} SET group_name = (SELECT name FROM #{table_list['invGroups']} WHERE id = #{table_list['invTypes']}.group_id))
|
56
57
|
sql %Q(UPDATE #{table_list['invTypes']} SET category_id = (SELECT category_id FROM #{table_list['invGroups']} WHERE id = #{table_list['invTypes']}.group_id))
|
57
58
|
sql %Q(UPDATE #{table_list['invTypes']} SET category_name = (SELECT name FROM #{table_list['invCategories']} WHERE id = #{table_list['invTypes']}.category_id))
|
58
59
|
sql %Q(UPDATE #{table_list['invTypes']} SET market_group_name = (SELECT name FROM #{table_list['invMarketGroups']} WHERE id = #{table_list['invTypes']}.market_group_id))
|
60
|
+
sql %Q(UPDATE #{table_list['invTypes']} SET blueprint_type_id = (SELECT type_id FROM #{table_list['industryActivityProducts']} WHERE activity_id = 1 AND product_type_id = #{table_list['invTypes']}.id LIMIT 1))
|
59
61
|
|
60
62
|
sql %Q(
|
61
63
|
WITH RECURSIVE mg_roots(id, root_id) AS (
|
data/lib/eve_app/version.rb
CHANGED