ish_manager 0.1.8.487 → 0.1.8.489

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33e51b9b4ac4f6e3ec605e6668b6b2688a840a7bca1672ae916a127e8392415d
4
- data.tar.gz: 01e58fe707cc02dc8addb155cd08390653a09b159c5ca035adef3ed238e430f4
3
+ metadata.gz: eeabedb9e57e736ebd35e8e73ac4387f3cb77aafda58658dcb913fff72e6ab1d
4
+ data.tar.gz: 5ed6cb10a9536857cc6e2c6f33dcd0a6f9bba66c4cbea4d939f43e44ee1f26cd
5
5
  SHA512:
6
- metadata.gz: 3244e5262927a77611abe82f489a93e9f3179e5fe1ac4d93b65d944530f4785206de0a61e0d0214345905a34f767a9919bfec9b391411bed67ecc74b309d2713
7
- data.tar.gz: 6701257ddbf4376754f7a33fc26a6f32663c684475e85e234a8acdd9861d7a4da6e9df7398e04c041b1bcf7445fbce6f84e6cbe6b19ab36dabad7390fc958f82
6
+ metadata.gz: e25f395330b7566a261f7dd9e0e0742bb0cf481ad6b1481c71004320d2acdc65cd9f2eb93dca4c231a7f7b2217dd74ef42b13a63c05d76e4f4ddffb795c108c2
7
+ data.tar.gz: e94184249552ace988a61121a50e4730600b279b519972c3cc91e3c884be5082e5c4fb011e519d6ca9db7042589c51612f145eca55343083d5be37a0c5e83324
@@ -42,6 +42,11 @@
42
42
  .thumbnails {
43
43
  .item {
44
44
  border: 1px solid blue;
45
+ display: flex;
46
+
47
+ > * {
48
+ margin-right: .5em;
49
+ }
45
50
  }
46
51
  }
47
52
 
@@ -0,0 +1,112 @@
1
+
2
+ class IshManager::AnalyticsController < IshManager::ApplicationController
3
+
4
+ before_action :set_vars
5
+
6
+ def index
7
+ authorize! :analytics, IshManager::Ability
8
+ end
9
+
10
+ def test
11
+ authorize! :analytics, IshManager::Ability
12
+
13
+ if !@prev_intervals.include?( params[:prev_interval] )
14
+ flash_error "prev_interval not allowed"
15
+ redirect_to action: :index
16
+ return
17
+ end
18
+ prev_interval = eval( params[:prev_interval] )
19
+ puts! prev_interval, 'prev_interval'
20
+
21
+ base_url = "https://analytics.wasya.co/index.php?force_api_session=1&module=API&format=JSON&"
22
+ api_url_trash = "&idDimension=1&idSite=2&period=day&date=2023-07-01,2023-09-01"
23
+ opts = {
24
+ "token_auth" => ANALYTICS_TOKEN,
25
+
26
+ # "method" => "Actions.getPageUrls",
27
+ method: params[:method],
28
+
29
+ "idDimension" => 1,
30
+
31
+ # "idSite" => 2,
32
+ idSite: params[:idSite],
33
+
34
+ "period" => "day",
35
+ # period: params[:period],
36
+
37
+ "date" => "#{(Time.now - prev_interval ).to_date.to_s},#{Time.now.to_date.to_s}",
38
+ }
39
+
40
+ cids = []
41
+ reports = {}
42
+
43
+ puts! "#{base_url}#{opts.to_query}", 'ze query'
44
+
45
+ inns = HTTParty.get( "#{base_url}#{opts.to_query}" )
46
+ inns = JSON.parse( inns.body )
47
+
48
+ inns.each do |date, items|
49
+ items.each do |item|
50
+
51
+ path = item['label']
52
+ if path[0] != '/'
53
+ path = "/#{path}"
54
+ end
55
+
56
+ cid = path[/.*cid=([\d]*)/,1]&.to_i
57
+ if cid
58
+ cids.push cid
59
+ reports[cid] ||= []
60
+ reports[cid].push "#{date} :: #{path}"
61
+ end
62
+ end
63
+ end
64
+
65
+ cids = cids.uniq.compact
66
+ leads_h = Lead.find_to_h cids
67
+ @reports = {}
68
+
69
+ reports.each do |k, v|
70
+ lead_label = "[#{k}] <#{leads_h[k].name} #{leads_h[k].email}>"
71
+ @reports[lead_label] = v
72
+ end
73
+
74
+ end
75
+
76
+ ##
77
+ ## private
78
+ ##
79
+ private
80
+
81
+ def set_vars
82
+ @methods_list = [
83
+ "Actions.getPageUrls",
84
+ ]
85
+
86
+
87
+ @prev_intervals = [
88
+ "1.month",
89
+ "2.months",
90
+ "3.months",
91
+ ]
92
+
93
+ @sites_list = [
94
+ [ '2 - wasya.co', 2 ],
95
+ [ '6 - wasyaco.com', 6 ],
96
+
97
+ [ '3 - old pi', 3 ],
98
+ [ '8 - pi_drup', 8 ],
99
+
100
+
101
+ [ 'bjjc_drup', 9 ],
102
+ [ 'bjjc_legacy', 12 ],
103
+
104
+ [ 'demmitv', 7 ],
105
+
106
+ [ 'ish', 5 ],
107
+
108
+
109
+ ]
110
+ end
111
+
112
+ end
@@ -0,0 +1,18 @@
1
+
2
+ .analytics--menu
3
+
4
+ %ul
5
+ %li= link_to 'Test', analytics_test_path
6
+
7
+ = form_tag( analytics_test_path, method: :get ) do
8
+ .field
9
+ %label Domain
10
+ = select_tag :idSite, options_for_select(@sites_list, selected: params[:idSite]), class: :select2
11
+ .field
12
+ %label prev_interval
13
+ = select_tag :prev_interval, options_for_select( @prev_intervals, selected: params[:prev_interval] )
14
+ .field
15
+ %label method
16
+ = select_tag :method, options_for_select( @methods_list, selected: params[:method] )
17
+ .actions
18
+ = submit_tag 'Submit'
@@ -0,0 +1,6 @@
1
+
2
+ .analytics-index.max-width
3
+ %h5 Analytics Index
4
+
5
+ = render 'ish_manager/analytics/menu'
6
+ %hr
@@ -0,0 +1,14 @@
1
+
2
+ .analytics-test.maxwidth
3
+ %h5 Analytics Test
4
+
5
+ = render 'ish_manager/analytics/menu'
6
+ %hr
7
+
8
+ %ul
9
+ - @reports.each do |email, paths|
10
+ %li
11
+ <b>#{email}:</b>
12
+ %ul
13
+ - paths.each do |p|
14
+ %li= p
@@ -105,6 +105,7 @@
105
105
  = link_to '[+]', new_office_action_path
106
106
  %li
107
107
  = link_to 'Unsubs', unsubscribes_path
108
+ = link_to 'Analytics', analytics_path
108
109
 
109
110
  .c
110
111
 
data/config/routes.rb CHANGED
@@ -1,8 +1,14 @@
1
1
 
2
2
  IshManager::Engine.routes.draw do
3
3
 
4
+ ##
5
+ ## A
6
+ ##
4
7
  root :to => 'application#home'
5
8
 
9
+ get 'analytics', to: 'analytics#index'
10
+ get 'analytics/test', to: 'analytics#test'
11
+
6
12
  get 'application/tinymce', to: 'application#tinymce'
7
13
 
8
14
  resources :appliances
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.487
4
+ version: 0.1.8.489
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -481,6 +481,7 @@ files:
481
481
  - app/assets/stylesheets/ish_manager/vendor/jquery-ui.css
482
482
  - app/assets/stylesheets/ish_manager/vendor/summernote-bs4.min.css
483
483
  - app/assets/stylesheets/ish_manager/videos.scss
484
+ - app/controllers/ish_manager/analytics_controller.rb
484
485
  - app/controllers/ish_manager/appliance_tmpls_controller.rb
485
486
  - app/controllers/ish_manager/appliances_controller.rb
486
487
  - app/controllers/ish_manager/application_controller.rb
@@ -567,6 +568,9 @@ files:
567
568
  - app/views/202212 Mailchimp Templates/202212 theme subtle.html
568
569
  - app/views/202212 Mailchimp Templates/202212 theme ticket.html
569
570
  - app/views/202212 Mailchimp Templates/202212 theme whale.html
571
+ - app/views/ish_manager/analytics/_menu.haml
572
+ - app/views/ish_manager/analytics/index.haml
573
+ - app/views/ish_manager/analytics/test.haml
570
574
  - app/views/ish_manager/appliance_tmpls/_form.haml
571
575
  - app/views/ish_manager/appliance_tmpls/index.haml
572
576
  - app/views/ish_manager/appliances/_form.haml