wco_models 3.1.0.275 → 3.1.0.276
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/wco/asset.rb +2 -1
- data/app/models/wco_email/conversation.rb +1 -2
- data/app/models/wco_email/email_filter.rb +8 -3
- data/app/models/wco_email/message_stub.rb +2 -11
- metadata +4 -23
- data/app/models/ahoy/event.rb +0 -15
- data/app/models/ahoy/visit.rb +0 -50
- data/app/models/do/dns_record.rb-txt +0 -15
- data/app/models/wco_game/location.rb +0 -257
- data/app/models/wco_game/marker.rb +0 -9
- /data/app/models/wco_email/{obfuscated_redirect.rb → obfuscated_redirect.rb-trash} +0 -0
- /data/config/initializers/{ahoy.rb → ahoy.rb-trash} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0d2d2fd07a9f97269d04402ecbe29c6e258f33d07a5e68c3cf4fc3e11066f146
|
|
4
|
+
data.tar.gz: 445ab09e9ac094715bcedcc994f3d70f97b3afdf4460513e1471912e6b960de9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b90e415933235fbc0a12e406da6ec7bc113b1e2119da06085812c50bcad796b956aca162ca518ec5592f3da90c62a85794d131f8331599760ee427b7bdb71c72
|
|
7
|
+
data.tar.gz: d67a830c270ac218edffaee49100c7ac94da66db961bd3957bf60acae2b6990338f0ace9cb0e3889a35d34876834b586b37cac13e48e04d0db51382afb29b909
|
data/app/models/wco/asset.rb
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
# require 'aws-sdk'
|
|
3
2
|
require 'mongoid_paperclip'
|
|
4
3
|
|
|
5
4
|
class Wco::Asset
|
|
@@ -9,6 +8,8 @@ class Wco::Asset
|
|
|
9
8
|
include Mongoid::Paranoia
|
|
10
9
|
include Wco::Utils
|
|
11
10
|
|
|
11
|
+
store_in collection: 'wco_assets'
|
|
12
|
+
|
|
12
13
|
field :filename
|
|
13
14
|
|
|
14
15
|
belongs_to :email_message, class_name: 'WcoEmail::Message', optional: true
|
|
@@ -32,8 +32,7 @@ class WcoEmail::Conversation
|
|
|
32
32
|
has_and_belongs_to_many :tags, class_name: 'Wco::Tag', index: true
|
|
33
33
|
has_and_belongs_to_many :leadsets, class_name: 'Wco::Leadset', index: true
|
|
34
34
|
has_and_belongs_to_many :leads, class_name: 'Wco::Lead', index: true
|
|
35
|
-
|
|
36
|
-
belongs_to :filter, class_name: 'WcoEmail::EmailFilter', inverse_of: :conversations, optional: true
|
|
35
|
+
has_and_belongs_to_many :filters, class_name: 'WcoEmail::EmailFilter', index: true
|
|
37
36
|
|
|
38
37
|
=begin
|
|
39
38
|
current_profile = OpenStruct.new per_page: 25
|
|
@@ -77,8 +77,7 @@ class WcoEmail::EmailFilter
|
|
|
77
77
|
belongs_to :office_action_template, class_name: '::Wco::OfficeActionTemplate', optional: true
|
|
78
78
|
belongs_to :tag, class_name: '::Wco::Tag', optional: true, inverse_of: :email_filters
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
has_many :conversations, class_name: '::WcoEmail::Conversation', inverse_of: :filter
|
|
80
|
+
has_and_belongs_to_many :conversations, class_name: '::WcoEmail::Conversation'
|
|
82
81
|
|
|
83
82
|
def to_s
|
|
84
83
|
"EmailFilter: #{from_regex} #{from_exact} #{conditions.map { |c| c.to_s }.join }"
|
|
@@ -87,8 +86,14 @@ class WcoEmail::EmailFilter
|
|
|
87
86
|
# inn = ""
|
|
88
87
|
# inn = "#{inn}#{conditions.map { |c| c.to_s_full }.join }" if conditions.present?
|
|
89
88
|
# inn = "#{inn}#{skip_conditions.map { |c| c.to_s_full }.join }" if skip_conditions.present?
|
|
89
|
+
|
|
90
|
+
attrs = ''
|
|
91
|
+
if from_regex || from_exact
|
|
92
|
+
attrs = "#{attrs} from=#{from_regex}#{from_exact}"
|
|
93
|
+
end
|
|
94
|
+
|
|
90
95
|
out =<<-AOL
|
|
91
|
-
<EmailFilter >
|
|
96
|
+
<EmailFilter#{attrs} >
|
|
92
97
|
#{conditions.map { |c| c.to_s_full( indent: 2) }.join }
|
|
93
98
|
#{skip_conditions.map { |c| c.to_s_full( indent: 2) }.join }
|
|
94
99
|
#{actions.map { |c| c.to_s_full( indent: 2) }.join }
|
|
@@ -170,7 +170,7 @@ class WcoEmail::MessageStub
|
|
|
170
170
|
if skip_reason
|
|
171
171
|
puts! "NOT Applying filter #{filter} to conv #{@message.conversation} for matching #{skip_reason}" if DEBUG
|
|
172
172
|
else
|
|
173
|
-
@conv.
|
|
173
|
+
@conv.filters << filter; @conv.save
|
|
174
174
|
filter.actions.each do |action|
|
|
175
175
|
@message.apply_filter_action( action )
|
|
176
176
|
end
|
|
@@ -186,16 +186,7 @@ class WcoEmail::MessageStub
|
|
|
186
186
|
|
|
187
187
|
|
|
188
188
|
def do_process
|
|
189
|
-
|
|
190
|
-
if Rails.env.production?
|
|
191
|
-
@client ||= Aws::S3::Client.new({
|
|
192
|
-
region: ::S3_CREDENTIALS[:region_ses],
|
|
193
|
-
access_key_id: ::S3_CREDENTIALS[:access_key_id_ses],
|
|
194
|
-
secret_access_key: ::S3_CREDENTIALS[:secret_access_key_ses],
|
|
195
|
-
})
|
|
196
|
-
else
|
|
197
|
-
@client ||= Aws::S3::Client.new(::SES_S3_CREDENTIALS)
|
|
198
|
-
end
|
|
189
|
+
@client ||= Aws::S3::Client.new(::SES_S3_CREDENTIALS)
|
|
199
190
|
|
|
200
191
|
stub = self
|
|
201
192
|
|
metadata
CHANGED
|
@@ -1,29 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wco_models
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.1.0.
|
|
4
|
+
version: 3.1.0.276
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Victor Pudeyev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
name: ahoy_matey
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - ">="
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0'
|
|
20
|
-
type: :runtime
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - ">="
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0'
|
|
27
13
|
- !ruby/object:Gem::Dependency
|
|
28
14
|
name: aws-sdk-s3
|
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -484,9 +470,6 @@ files:
|
|
|
484
470
|
- app/mailers/iro/alert_mailer.rb
|
|
485
471
|
- app/mailers/wco_email/application_mailer.rb
|
|
486
472
|
- app/models/ability.rb
|
|
487
|
-
- app/models/ahoy/event.rb
|
|
488
|
-
- app/models/ahoy/visit.rb
|
|
489
|
-
- app/models/do/dns_record.rb-txt
|
|
490
473
|
- app/models/iro/alert.rb
|
|
491
474
|
- app/models/iro/datapoint.rb
|
|
492
475
|
- app/models/iro/date.rb
|
|
@@ -543,10 +526,8 @@ files:
|
|
|
543
526
|
- app/models/wco_email/email_template.rb
|
|
544
527
|
- app/models/wco_email/message.rb
|
|
545
528
|
- app/models/wco_email/message_stub.rb
|
|
546
|
-
- app/models/wco_email/obfuscated_redirect.rb
|
|
529
|
+
- app/models/wco_email/obfuscated_redirect.rb-trash
|
|
547
530
|
- app/models/wco_email/unsubscribe.rb
|
|
548
|
-
- app/models/wco_game/location.rb
|
|
549
|
-
- app/models/wco_game/marker.rb
|
|
550
531
|
- app/models/wco_hosting/appliance.rb
|
|
551
532
|
- app/models/wco_hosting/appliance_tmpl.rb
|
|
552
533
|
- app/models/wco_hosting/domain.rb
|
|
@@ -789,7 +770,7 @@ files:
|
|
|
789
770
|
- config/initializers/00_s3.rb-example
|
|
790
771
|
- config/initializers/08_integrations.rb
|
|
791
772
|
- config/initializers/08_integrations.rb-example
|
|
792
|
-
- config/initializers/ahoy.rb
|
|
773
|
+
- config/initializers/ahoy.rb-trash
|
|
793
774
|
- config/initializers/assets.rb
|
|
794
775
|
- config/routes.rb
|
|
795
776
|
- lib/20260402_tmp.rb
|
data/app/models/ahoy/event.rb
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
class Ahoy::Event
|
|
3
|
-
include Mongoid::Document
|
|
4
|
-
|
|
5
|
-
# associations
|
|
6
|
-
belongs_to :visit, class_name: "Ahoy::Visit", index: true
|
|
7
|
-
belongs_to :user, index: true, optional: true
|
|
8
|
-
|
|
9
|
-
# fields
|
|
10
|
-
field :name, type: String
|
|
11
|
-
field :properties, type: Hash
|
|
12
|
-
field :time, type: Time
|
|
13
|
-
|
|
14
|
-
index({name: 1, time: 1})
|
|
15
|
-
end
|
data/app/models/ahoy/visit.rb
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
class Ahoy::Visit
|
|
3
|
-
include Mongoid::Document
|
|
4
|
-
|
|
5
|
-
# associations
|
|
6
|
-
has_many :events, class_name: "Ahoy::Event"
|
|
7
|
-
belongs_to :user, index: true, optional: true
|
|
8
|
-
|
|
9
|
-
# required
|
|
10
|
-
field :visit_token, type: String
|
|
11
|
-
field :visitor_token, type: String
|
|
12
|
-
|
|
13
|
-
# the rest are recommended but optional
|
|
14
|
-
# simply remove the columns you don't want
|
|
15
|
-
|
|
16
|
-
# standard
|
|
17
|
-
field :ip, type: String
|
|
18
|
-
field :user_agent, type: String
|
|
19
|
-
field :referrer, type: String
|
|
20
|
-
field :referring_domain, type: String
|
|
21
|
-
field :landing_page, type: String
|
|
22
|
-
|
|
23
|
-
# technology
|
|
24
|
-
field :browser, type: String
|
|
25
|
-
field :os, type: String
|
|
26
|
-
field :device_type, type: String
|
|
27
|
-
|
|
28
|
-
# location
|
|
29
|
-
field :country, type: String
|
|
30
|
-
field :region, type: String
|
|
31
|
-
field :city, type: String
|
|
32
|
-
field :latitude, type: Float
|
|
33
|
-
field :longitude, type: Float
|
|
34
|
-
|
|
35
|
-
# utm parameters
|
|
36
|
-
field :utm_source, type: String
|
|
37
|
-
field :utm_medium, type: String
|
|
38
|
-
field :utm_term, type: String
|
|
39
|
-
field :utm_content, type: String
|
|
40
|
-
field :utm_campaign, type: String
|
|
41
|
-
|
|
42
|
-
# native apps
|
|
43
|
-
field :app_version, type: String
|
|
44
|
-
field :os_version, type: String
|
|
45
|
-
field :platform, type: String
|
|
46
|
-
|
|
47
|
-
field :started_at, type: Time
|
|
48
|
-
|
|
49
|
-
index({visit_token: 1}, {unique: true})
|
|
50
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
From: https://docs.digitalocean.com/reference/api/digitalocean/#tag/Domain-Records/operation/domains_list_records
|
|
3
|
-
|
|
4
|
-
new:
|
|
5
|
-
|
|
6
|
-
POST /v2/domains/$DOMAIN_NAME/records
|
|
7
|
-
|
|
8
|
-
{
|
|
9
|
-
type: 'A',
|
|
10
|
-
name: 'subdomain',
|
|
11
|
-
data: '127.0.0.1',
|
|
12
|
-
ttl: 3600,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
DELETE /v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
# require 'ish/premium_item'
|
|
3
|
-
# require 'ish/utils'
|
|
4
|
-
|
|
5
|
-
class WcoGame::Location
|
|
6
|
-
include Mongoid::Document
|
|
7
|
-
include Mongoid::Timestamps
|
|
8
|
-
# include Ish::PremiumItem
|
|
9
|
-
include Mongoid::Paranoia
|
|
10
|
-
include Wco::Utils
|
|
11
|
-
store_in collection: 'gameui_maps'
|
|
12
|
-
|
|
13
|
-
field :name
|
|
14
|
-
|
|
15
|
-
field :newsitems_page_size, default: 25
|
|
16
|
-
|
|
17
|
-
field :slug
|
|
18
|
-
validates :slug, uniqueness: true, presence: true
|
|
19
|
-
|
|
20
|
-
field :description
|
|
21
|
-
|
|
22
|
-
has_many :markers, :class_name => '::Gameui::Marker', inverse_of: :map
|
|
23
|
-
has_many :from_markers, :class_name => '::Gameui::Marker', inverse_of: :destination
|
|
24
|
-
|
|
25
|
-
has_many :newsitems, inverse_of: :map, order: :created_at.desc
|
|
26
|
-
|
|
27
|
-
# @TODO: remove field, replace with relation. _vp_ 2022-09-13
|
|
28
|
-
field :parent_slug
|
|
29
|
-
belongs_to :parent, class_name: '::Gameui::Map', inverse_of: :childs, optional: true
|
|
30
|
-
has_many :childs, class_name: '::Gameui::Map', inverse_of: :parent
|
|
31
|
-
|
|
32
|
-
has_one :image, class_name: '::Ish::ImageAsset', inverse_of: :location
|
|
33
|
-
belongs_to :creator_profile, class_name: '::Ish::UserProfile', inverse_of: :my_maps
|
|
34
|
-
|
|
35
|
-
has_and_belongs_to_many :bookmarked_profiles, class_name: '::Ish::UserProfile', inverse_of: :bookmarked_location
|
|
36
|
-
|
|
37
|
-
# shareable, nonpublic
|
|
38
|
-
field :is_public, type: Boolean, default: true
|
|
39
|
-
scope :public, ->{ where( is_public: true ) }
|
|
40
|
-
has_and_belongs_to_many :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_locations
|
|
41
|
-
|
|
42
|
-
field :version, type: String, default: '0.0.0'
|
|
43
|
-
|
|
44
|
-
## @TODO: or self, right? and refactor this, seems N+1. _vp_ 2022-09-13
|
|
45
|
-
field :map_slug
|
|
46
|
-
def map
|
|
47
|
-
::Gameui::Map.where( slug: map_slug ).first
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
RATED_OPTIONS = [ 'pg-13', 'r', 'nc-17' ]
|
|
51
|
-
field :rated, default: 'pg-13' # 'r', 'nc-17'
|
|
52
|
-
|
|
53
|
-
## Possible keys: description, map, markers, newsitems,
|
|
54
|
-
field :labels, type: Object, default: <<~AOL
|
|
55
|
-
{ "description":"Description", "map":"Map", "markers":"Markers", "newsitems":"Newsitems"
|
|
56
|
-
}
|
|
57
|
-
AOL
|
|
58
|
-
|
|
59
|
-
## Possible keys:
|
|
60
|
-
## config.description.collapsible
|
|
61
|
-
field :config, type: Object, default: <<~AOL
|
|
62
|
-
{ "map_panel_type": "ThreePanelV1",
|
|
63
|
-
"studio": { "hasFloor": true, "studioLength": 2500, "studioWidth": 2500 }
|
|
64
|
-
}
|
|
65
|
-
AOL
|
|
66
|
-
|
|
67
|
-
# @deprecated, dont use!
|
|
68
|
-
field :img_path
|
|
69
|
-
|
|
70
|
-
## Not used! See config.map_panel_type instead.
|
|
71
|
-
# MAP_TYPES = [ :map_2d, :map_3d, :map_geospatial, :map_gallery, :map_toc ] ## Mostly not implemented. _vp_ 2022-09-06
|
|
72
|
-
# field :map_type, default: :map_2d
|
|
73
|
-
|
|
74
|
-
## Make sure to use x,y,z and w,h as appropriate.
|
|
75
|
-
## @TODO: abstract this into a module
|
|
76
|
-
field :x, type: Float
|
|
77
|
-
field :y, type: Float
|
|
78
|
-
field :z, type: Float
|
|
79
|
-
|
|
80
|
-
## Make sure to use x,y,z and w,h as appropriate.
|
|
81
|
-
field :w, type: Integer
|
|
82
|
-
validates :w, presence: true
|
|
83
|
-
field :h, type: Integer
|
|
84
|
-
validates :h, presence: true
|
|
85
|
-
# @TODO: this is shared between map and marker, move to a concern.
|
|
86
|
-
before_validation :compute_w_h
|
|
87
|
-
def compute_w_h
|
|
88
|
-
return if !image ## @TODO: test this
|
|
89
|
-
|
|
90
|
-
begin
|
|
91
|
-
geo = Paperclip::Geometry.from_file(Paperclip.io_adapters.for(image.image))
|
|
92
|
-
self.w = geo.width
|
|
93
|
-
self.h = geo.height
|
|
94
|
-
rescue Paperclip::Errors::NotIdentifiedByImageMagickError => e
|
|
95
|
-
puts! e, 'Could not #compute_w_h'
|
|
96
|
-
# @TODO: do something with this
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
ORDERING_TYPE_ALPHABETIC = 'alphabetic'
|
|
101
|
-
ORDERING_TYPE_CUSTOM = 'custom'
|
|
102
|
-
ORDERING_TYPE_TIMESTAMP = 'timestamp'
|
|
103
|
-
ORDERING_TYPES = [ ORDERING_TYPE_ALPHABETIC, ORDERING_TYPE_CUSTOM, ORDERING_TYPE_TIMESTAMP ]
|
|
104
|
-
field :ordering_type, type: String, default: 'custom' # timestamp, alphabetic, custom
|
|
105
|
-
validates :ordering_type, presence: true
|
|
106
|
-
|
|
107
|
-
def self.list conditions = { is_trash: false }
|
|
108
|
-
out = self.order_by( created_at: :desc )
|
|
109
|
-
[[nil, nil]] + out.map { |item| [ item.name, item.id.to_s ] }
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
def breadcrumbs
|
|
113
|
-
out = [{ name: self.name, slug: self.slug, link: false }]
|
|
114
|
-
p = self.parent
|
|
115
|
-
while p
|
|
116
|
-
out.push({ name: p.name, slug: p.slug })
|
|
117
|
-
p = p.parent
|
|
118
|
-
end
|
|
119
|
-
out.reverse
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
##
|
|
123
|
-
## @TODO: move the export func, below, to a module. _vp_ 2022-09-20
|
|
124
|
-
##
|
|
125
|
-
|
|
126
|
-
def empty_export
|
|
127
|
-
return {
|
|
128
|
-
galleries: {},
|
|
129
|
-
image_assets: {},
|
|
130
|
-
maps: {}, markers: {},
|
|
131
|
-
newsitems: {},
|
|
132
|
-
photos: {}, profiles: {},
|
|
133
|
-
reports: {},
|
|
134
|
-
videos: {},
|
|
135
|
-
}
|
|
136
|
-
end
|
|
137
|
-
def self.empty_export; Gameui::Map.new.empty_export; end
|
|
138
|
-
|
|
139
|
-
def empty_export_arr
|
|
140
|
-
return {
|
|
141
|
-
galleries: [],
|
|
142
|
-
image_assets: [],
|
|
143
|
-
maps: [], markers: [],
|
|
144
|
-
newsitems: [],
|
|
145
|
-
photos: [], profiles: [],
|
|
146
|
-
reports: [],
|
|
147
|
-
videos: [],
|
|
148
|
-
}
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
def export_key_to_class
|
|
152
|
-
return {
|
|
153
|
-
galleries: 'Gallery',
|
|
154
|
-
image_assets: 'Ish::ImageAsset',
|
|
155
|
-
maps: 'Gameui::Map',
|
|
156
|
-
markers: 'Gameui::Marker',
|
|
157
|
-
newsitems: 'Newsitem',
|
|
158
|
-
photos: 'Photo',
|
|
159
|
-
profiles: 'Ish::UserProfile',
|
|
160
|
-
reports: 'Report',
|
|
161
|
-
videos: 'Video',
|
|
162
|
-
# 'galleries' => 'Gallery',
|
|
163
|
-
# 'image_assets' => 'Ish::ImageAsset',
|
|
164
|
-
# 'maps' => 'Gameui::Map',
|
|
165
|
-
# 'markers' => 'Gameui::Marker',
|
|
166
|
-
# 'newsitems' => 'Newsitem',
|
|
167
|
-
# 'photos' => 'Photo',
|
|
168
|
-
# 'profiles' => 'Ish::UserProfile',
|
|
169
|
-
# 'reports' => 'Report',
|
|
170
|
-
# 'videos' => 'Video',
|
|
171
|
-
}.with_indifferent_access
|
|
172
|
-
end
|
|
173
|
-
def self.export_key_to_class
|
|
174
|
-
Map.new.export_key_to_class
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
def export_fields
|
|
178
|
-
%w|
|
|
179
|
-
creator_profile_id config
|
|
180
|
-
deleted_at description
|
|
181
|
-
h
|
|
182
|
-
is_public
|
|
183
|
-
labels
|
|
184
|
-
map_slug
|
|
185
|
-
name
|
|
186
|
-
ordering_type
|
|
187
|
-
parent_slug
|
|
188
|
-
rated
|
|
189
|
-
slug
|
|
190
|
-
version
|
|
191
|
-
w
|
|
192
|
-
|
|
|
193
|
-
end
|
|
194
|
-
|
|
195
|
-
## This is the starting point _vp_ 2022-03-12
|
|
196
|
-
##
|
|
197
|
-
def export_subtree
|
|
198
|
-
collected = collect(empty_export)
|
|
199
|
-
exportable = empty_export_arr
|
|
200
|
-
collected.map do |k, v|
|
|
201
|
-
if v.present?
|
|
202
|
-
v.map do |id|
|
|
203
|
-
id = id[0]
|
|
204
|
-
item = export_key_to_class[k].constantize.unscoped.find id
|
|
205
|
-
export = item.export
|
|
206
|
-
exportable[k].push( export )
|
|
207
|
-
end
|
|
208
|
-
end
|
|
209
|
-
end
|
|
210
|
-
JSON.pretty_generate exportable
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
def collect export_object
|
|
214
|
-
map = self
|
|
215
|
-
export_object[:maps][map.id.to_s] = map.id.to_s
|
|
216
|
-
|
|
217
|
-
if map.markers.present?
|
|
218
|
-
map.markers.map do |marker|
|
|
219
|
-
id = marker.id.to_s
|
|
220
|
-
if !export_object[:markers][id]
|
|
221
|
-
marker.collect( export_object )
|
|
222
|
-
end
|
|
223
|
-
export_object[:markers][id] = id
|
|
224
|
-
end
|
|
225
|
-
end
|
|
226
|
-
|
|
227
|
-
if map.newsitems.present?
|
|
228
|
-
map.newsitems.map do |newsitem|
|
|
229
|
-
id = newsitem.id.to_s
|
|
230
|
-
export_object[:newsitems][id] = id
|
|
231
|
-
newsitem.collect export_object
|
|
232
|
-
end
|
|
233
|
-
end
|
|
234
|
-
|
|
235
|
-
## @TODO: maybe implement this later, maybe not. _vp_ 2022-03-12
|
|
236
|
-
# if map.childs.present?
|
|
237
|
-
# export_object[:maps].push( map.childs.map &:id )
|
|
238
|
-
# map.childs.map do |child|
|
|
239
|
-
# child.collect export_object
|
|
240
|
-
# end
|
|
241
|
-
# end
|
|
242
|
-
|
|
243
|
-
if map.creator_profile.present?
|
|
244
|
-
export_object[:profiles][map.creator_profile.id.to_s] = map.creator_profile.id.to_s
|
|
245
|
-
end
|
|
246
|
-
|
|
247
|
-
if map.image.present?
|
|
248
|
-
export_object[:image_assets][map.image.id.to_s] = map.image.id.to_s
|
|
249
|
-
end
|
|
250
|
-
|
|
251
|
-
export_object
|
|
252
|
-
end
|
|
253
|
-
|
|
254
|
-
## endExport
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
end
|
|
File without changes
|
|
File without changes
|