Last active
January 2, 2018 19:51
-
-
Save crova/68c6dc1bf8e03e20cc7c088d66230938 to your computer and use it in GitHub Desktop.
Can't figure what is going on here
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| undefined method `tag' for [:requests, 0]:Array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The view shows what it is supposed to show |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app/views/sib_transacs/wm_sweep_abd_2k18_follow_up.html.erb:186:in `block in _app_views_sib_transacs_wm_sweep_abd__k___follow_up_html_erb___3833589783519902933_70272483280580' | |
| app/views/sib_transacs/wm_sweep_abd_2k18_follow_up.html.erb:183:in `each' | |
| app/views/sib_transacs/wm_sweep_abd_2k18_follow_up.html.erb:183:in `_app_views_sib_transacs_wm_sweep_abd__k___follow_up_html_erb___3833589783519902933_70272483280580' | |
| actionview (5.0.6) lib/action_view/template.rb:159:in `block in render' | |
| activesupport (5.0.6) lib/active_support/notifications.rb:166:in `instrument' | |
| actionview (5.0.6) lib/action_view/template.rb:354:in `instrument' | |
| actionview (5.0.6) lib/action_view/template.rb:157:in `render' | |
| actionview (5.0.6) lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template' | |
| actionview (5.0.6) lib/action_view/renderer/abstract_renderer.rb:42:in `block in instrument' | |
| activesupport (5.0.6) lib/active_support/notifications.rb:164:in `block in instrument' | |
| activesupport (5.0.6) lib/active_support/notifications/instrumenter.rb:21:in `instrument' | |
| activesupport (5.0.6) lib/active_support/notifications.rb:164:in `instrument' | |
| actionview (5.0.6) lib/action_view/renderer/abstract_renderer.rb:41:in `instrument' | |
| actionview (5.0.6) lib/action_view/renderer/template_renderer.rb:53:in `block in render_template' | |
| actionview (5.0.6) lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout' | |
| actionview (5.0.6) lib/action_view/renderer/template_renderer.rb:52:in `render_template' | |
| actionview (5.0.6) lib/action_view/renderer/template_renderer.rb:14:in `render' | |
| actionview (5.0.6) lib/action_view/renderer/renderer.rb:42:in `render_template' | |
| actionview (5.0.6) lib/action_view/renderer/renderer.rb:23:in `render' | |
| actionview (5.0.6) lib/action_view/rendering.rb:104:in `_render_template' | |
| actionpack (5.0.6) lib/action_controller/metal/streaming.rb:217:in `_render_template' | |
| actionview (5.0.6) lib/action_view/rendering.rb:83:in `render_to_body' | |
| actionpack (5.0.6) lib/action_controller/metal/rendering.rb:52:in `render_to_body' | |
| actionpack (5.0.6) lib/action_controller/metal/renderers.rb:142:in `render_to_body' | |
| actionpack (5.0.6) lib/abstract_controller/rendering.rb:26:in `render' | |
| actionpack (5.0.6) lib/action_controller/metal/rendering.rb:36:in `render' | |
| actionpack (5.0.6) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render' | |
| activesupport (5.0.6) lib/active_support/core_ext/benchmark.rb:12:in `block in ms' | |
| /home/crova/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/benchmark.rb:308:in `realtime' | |
| activesupport (5.0.6) lib/active_support/core_ext/benchmark.rb:12:in `ms' | |
| actionpack (5.0.6) lib/action_controller/metal/instrumentation.rb:44:in `block in render' | |
| actionpack (5.0.6) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime' | |
| activerecord (5.0.6) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime' | |
| actionpack (5.0.6) lib/action_controller/metal/instrumentation.rb:43:in `render' | |
| actionpack (5.0.6) lib/action_controller/metal/implicit_render.rb:36:in `default_render' | |
| actionpack (5.0.6) lib/action_controller/metal/basic_implicit_render.rb:4:in `block in send_action' | |
| actionpack (5.0.6) lib/action_controller/metal/basic_implicit_render.rb:4:in `tap' | |
| actionpack (5.0.6) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action' | |
| actionpack (5.0.6) lib/abstract_controller/base.rb:188:in `process_action' | |
| actionpack (5.0.6) lib/action_controller/metal/rendering.rb:30:in `process_action' | |
| actionpack (5.0.6) lib/abstract_controller/callbacks.rb:20:in `block in process_action' | |
| activesupport (5.0.6) lib/active_support/callbacks.rb:126:in `call' | |
| activesupport (5.0.6) lib/active_support/callbacks.rb:506:in `block (2 levels) in compile' | |
| activesupport (5.0.6) lib/active_support/callbacks.rb:455:in `call' | |
| activesupport (5.0.6) lib/active_support/callbacks.rb:101:in `__run_callbacks__' | |
| activesupport (5.0.6) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks' | |
| activesupport (5.0.6) lib/active_support/callbacks.rb:90:in `run_callbacks' | |
| actionpack (5.0.6) lib/abstract_controller/callbacks.rb:19:in `process_action' | |
| actionpack (5.0.6) lib/action_controller/metal/rescue.rb:20:in `process_action' | |
| actionpack (5.0.6) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' | |
| activesupport (5.0.6) lib/active_support/notifications.rb:164:in `block in instrument' | |
| activesupport (5.0.6) lib/active_support/notifications/instrumenter.rb:21:in `instrument' | |
| activesupport (5.0.6) lib/active_support/notifications.rb:164:in `instrument' | |
| actionpack (5.0.6) lib/action_controller/metal/instrumentation.rb:30:in `process_action' | |
| actionpack (5.0.6) lib/action_controller/metal/params_wrapper.rb:248:in `process_action' | |
| activerecord (5.0.6) lib/active_record/railties/controller_runtime.rb:18:in `process_action' | |
| actionpack (5.0.6) lib/abstract_controller/base.rb:126:in `process' | |
| actionview (5.0.6) lib/action_view/rendering.rb:30:in `process' | |
| actionpack (5.0.6) lib/action_controller/metal.rb:190:in `dispatch' | |
| actionpack (5.0.6) lib/action_controller/metal.rb:262:in `dispatch' | |
| actionpack (5.0.6) lib/action_dispatch/routing/route_set.rb:50:in `dispatch' | |
| actionpack (5.0.6) lib/action_dispatch/routing/route_set.rb:32:in `serve' | |
| actionpack (5.0.6) lib/action_dispatch/journey/router.rb:39:in `block in serve' | |
| actionpack (5.0.6) lib/action_dispatch/journey/router.rb:26:in `each' | |
| actionpack (5.0.6) lib/action_dispatch/journey/router.rb:26:in `serve' | |
| actionpack (5.0.6) lib/action_dispatch/routing/route_set.rb:727:in `call' | |
| warden (1.2.7) lib/warden/manager.rb:36:in `block in call' | |
| warden (1.2.7) lib/warden/manager.rb:35:in `catch' | |
| warden (1.2.7) lib/warden/manager.rb:35:in `call' | |
| rack (2.0.3) lib/rack/etag.rb:25:in `call' | |
| rack (2.0.3) lib/rack/conditional_get.rb:25:in `call' | |
| rack (2.0.3) lib/rack/head.rb:12:in `call' | |
| rack (2.0.3) lib/rack/session/abstract/id.rb:232:in `context' | |
| rack (2.0.3) lib/rack/session/abstract/id.rb:226:in `call' | |
| actionpack (5.0.6) lib/action_dispatch/middleware/cookies.rb:613:in `call' | |
| activerecord (5.0.6) lib/active_record/migration.rb:553:in `call' | |
| actionpack (5.0.6) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call' | |
| activesupport (5.0.6) lib/active_support/callbacks.rb:97:in `__run_callbacks__' | |
| activesupport (5.0.6) lib/active_support/callbacks.rb:750:in `_run_call_callbacks' | |
| activesupport (5.0.6) lib/active_support/callbacks.rb:90:in `run_callbacks' | |
| actionpack (5.0.6) lib/action_dispatch/middleware/callbacks.rb:36:in `call' | |
| actionpack (5.0.6) lib/action_dispatch/middleware/executor.rb:12:in `call' | |
| actionpack (5.0.6) lib/action_dispatch/middleware/remote_ip.rb:79:in `call' | |
| actionpack (5.0.6) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call' | |
| web-console (3.5.1) lib/web_console/middleware.rb:135:in `call_app' | |
| web-console (3.5.1) lib/web_console/middleware.rb:28:in `block in call' | |
| web-console (3.5.1) lib/web_console/middleware.rb:18:in `catch' | |
| web-console (3.5.1) lib/web_console/middleware.rb:18:in `call' | |
| actionpack (5.0.6) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call' | |
| railties (5.0.6) lib/rails/rack/logger.rb:36:in `call_app' | |
| railties (5.0.6) lib/rails/rack/logger.rb:24:in `block in call' | |
| activesupport (5.0.6) lib/active_support/tagged_logging.rb:69:in `block in tagged' | |
| activesupport (5.0.6) lib/active_support/tagged_logging.rb:26:in `tagged' | |
| activesupport (5.0.6) lib/active_support/tagged_logging.rb:69:in `tagged' | |
| railties (5.0.6) lib/rails/rack/logger.rb:24:in `call' | |
| sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call' | |
| actionpack (5.0.6) lib/action_dispatch/middleware/request_id.rb:24:in `call' | |
| rack (2.0.3) lib/rack/method_override.rb:22:in `call' | |
| rack (2.0.3) lib/rack/runtime.rb:22:in `call' | |
| activesupport (5.0.6) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' | |
| actionpack (5.0.6) lib/action_dispatch/middleware/executor.rb:12:in `call' | |
| actionpack (5.0.6) lib/action_dispatch/middleware/static.rb:136:in `call' | |
| rack (2.0.3) lib/rack/sendfile.rb:111:in `call' | |
| railties (5.0.6) lib/rails/engine.rb:522:in `call' | |
| puma (3.11.0) lib/puma/configuration.rb:225:in `call' | |
| puma (3.11.0) lib/puma/server.rb:624:in `handle_request' | |
| puma (3.11.0) lib/puma/server.rb:438:in `process_client' | |
| puma (3.11.0) lib/puma/server.rb:302:in `block in run' | |
| puma (3.11.0) lib/puma/thread_pool.rb:120:in `block in spawn_thread' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <p id="notice"><%= notice %></p> | |
| <!-- Defines which Navigation menu will be displayed based on current user status --> | |
| <% if current_user.admin? %> | |
| <div><%= render "admins_transac_navigation" %></div> | |
| <% else %> | |
| <div><%= render "users_transac_navigation" %></div> | |
| <% end %> | |
| <!-- This is what is being displayed to Admin Users (all info about all databases) --> | |
| <% if current_user.admin? %> | |
| <div class="container"> | |
| <center> | |
| <h1>Details for WM - Gmail & Cia Collecte</h1> | |
| <br> | |
| <div class="row"> | |
| <div class="col-sm-4 month-recap"> | |
| <table class="monet-table"> | |
| <tr> | |
| <th colspan="7">Month Recap WM - Gmail & Cia Collecte</th> | |
| </tr> | |
| <tr> | |
| <td>Month</td> | |
| <td>Open Rate</td> | |
| <td>Click Rate</td> | |
| <td>Margin</td> | |
| <td>eCPM</td> | |
| <td>Activated</td> | |
| </tr> | |
| <tr> | |
| <td><%= Date.today.strftime("%m") %></td> | |
| <td><%= number_with_precision(@wm_gmail_e_cia_all_month[:orate], :precision => 2) %> %</td> | |
| <td><%= number_with_precision(@wm_gmail_e_cia_all_month[:crate], :precision => 2) %> %</td> | |
| <td><%= number_with_precision(@wm_gmail_e_cia_all_month[:margin], :precision => 2) %> €</td> | |
| <td><%= number_with_precision(@wm_gmail_e_cia_all_month[:ecpm], :precision => 2) %> €</td> | |
| <td><%= number_with_precision(@wm_gmail_e_cia_all_month[:unique_opens], :precision => 0) %></td> | |
| </tr> | |
| </table> | |
| </div> | |
| </div> | |
| </center> | |
| <br> | |
| <div class="row"> | |
| <table class="monet-table"> | |
| <tr> | |
| <th colspan="13">Campaigns to be updated: <%= @wm_gmail_e_cia_to_update %></th> | |
| </tr> | |
| <tr> | |
| <th> </th> | |
| <th> </th> | |
| <th> TAG</th> | |
| <th> Date</th> | |
| <th> Volume</th> | |
| <th> Delivered</th> | |
| <th> Open Rate</th> | |
| <th> Click Rate</th> | |
| <th> Result</th> | |
| <th> Turn Over</th> | |
| <th> Cost</th> | |
| <th> eCPM</th> | |
| <th> Margin</th> | |
| <!-- <th> ROI</th> --> | |
| </tr> | |
| <tr> | |
| <th> Filter:</th> | |
| <th> </th> | |
| <th> </th> | |
| <th><%= link_to '⇑', {:controller => 'campaign', :action => 'camp_newest', order: 'by_date_newest'} %> | <%= link_to '⇓', {:controller => 'campaign', :action => 'camp_oldest', order: 'by_date_oldest'} %></th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| </tr> | |
| <% @wm_gmail_e_cia_all.each do |campaign| %> | |
| <tr> | |
| <td><%= link_to(image_tag("eyeicon.png", :size => '25x25', :alt => "details"), {:action => 'show', :id => campaign.id}, :class => 'back-link') %></td> | |
| <td><%= link_to(image_tag("pencil.png", :size => '25x25', :alt => "details"), {:action => 'edit', :id => campaign.id}, :class => 'back-link') %></td> | |
| <td><%= campaign.tag %></td> | |
| <td><%= campaign.date %></td> | |
| <td><%= campaign.requests %></td> | |
| <td><%= campaign.delivered %></td> | |
| <td><%= number_with_precision((campaign.unique_opens.to_f / campaign.requests.to_f) * 100, :precision => 2) %> %</td> | |
| <td><%= number_with_precision((campaign.unique_clicks.to_f / campaign.requests.to_f) * 100, :precision => 2) %> %</td> | |
| <td><%= number_with_precision(campaign.result, :precision => 0) %> </td> | |
| <td><%= number_with_precision(campaign.turnover, :precision => 2) %> €</td> | |
| <td><%= number_with_precision(campaign.cost, :precision => 2) %> €</td> | |
| <td><%= number_with_precision(campaign.ecpm, :precision => 2) %> €</td> | |
| <td><%= number_with_precision(campaign.margin, :precision => 2) %> €</td> | |
| <!-- <td><%= number_with_precision(campaign.roi, :precision => 2) %> €</td> --> | |
| </tr> | |
| <br> | |
| <% end %> | |
| </table> | |
| <div class="digg_pagination"> | |
| <%= will_paginate @wm_gmail_e_cia_all %> | |
| </div> | |
| </div> | |
| </div> | |
| <br /> | |
| <!-- Template for Admin ends here --> | |
| <% else %> | |
| <!-- Template for other users starts here (only has information on ABD 2K18) --> | |
| <center> | |
| <h1>Details for WM - Gmail & Cia Collecte</h1> | |
| <br> | |
| <div class="row"> | |
| <div class="col-sm-4 month-recap"> | |
| <table class="monet-table"> | |
| <tr> | |
| <th colspan="7">Month Recap WM - Gmail & Cia Collecte</th> | |
| </tr> | |
| <tr> | |
| <td>Month</td> | |
| <td>Open Rate</td> | |
| <td>Click Rate</td> | |
| <td>Margin</td> | |
| <td>eCPM</td> | |
| <td>Activated</td> | |
| </tr> | |
| <tr> | |
| <td><%= Date.today.strftime("%m") %></td> | |
| <td><%= number_with_precision(@wm_gmail_e_cia_all_month[:orate], :precision => 2) %> %</td> | |
| <td><%= number_with_precision(@wm_gmail_e_cia_all_month[:crate], :precision => 2) %> %</td> | |
| <td><%= number_with_precision(@wm_gmail_e_cia_all_month[:margin], :precision => 2) %> €</td> | |
| <td><%= number_with_precision(@wm_gmail_e_cia_all_month[:ecpm], :precision => 2) %> €</td> | |
| <td><%= number_with_precision(@wm_gmail_e_cia_all_month[:unique_opens], :precision => 0) %></td> | |
| </tr> | |
| </table> | |
| </div> | |
| </div> | |
| </center> | |
| <br> | |
| <div class="row"> | |
| <table class="monet-table"> | |
| <tr> | |
| <th colspan="13">Campaigns to be updated: <%= @wm_gmail_e_cia_to_update %></th> | |
| </tr> | |
| <tr> | |
| <th> </th> | |
| <th> </th> | |
| <th> TAG</th> | |
| <th> Date</th> | |
| <th> Volume</th> | |
| <th> Delivered</th> | |
| <th> Open Rate</th> | |
| <th> Click Rate</th> | |
| <th> Result</th> | |
| <th> Turn Over</th> | |
| <th> Cost</th> | |
| <th> eCPM</th> | |
| <th> Margin</th> | |
| <!-- <th> ROI</th> --> | |
| </tr> | |
| <tr> | |
| <th> Filter:</th> | |
| <th> </th> | |
| <th> </th> | |
| <th><%= link_to '⇑', {:controller => 'campaign', :action => 'camp_newest', order: 'by_date_newest'} %> | <%= link_to '⇓', {:controller => 'campaign', :action => 'camp_oldest', order: 'by_date_oldest'} %></th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| </tr> | |
| <% @wm_gmail_e_cia_all.each do |campaign| %> | |
| <tr> | |
| <td><%= link_to(image_tag("eyeicon.png", :size => '25x25', :alt => "details"), {:action => 'show', :id => campaign.id}, :class => 'back-link') %></td> | |
| <td><%= link_to(image_tag("pencil.png", :size => '25x25', :alt => "details"), {:action => 'edit', :id => campaign.id}, :class => 'back-link') %></td> | |
| <td><%= campaign.tag %></td> | |
| <td><%= campaign.date %></td> | |
| <td><%= campaign.requests %></td> | |
| <td><%= campaign.delivered %></td> | |
| <td><%= number_with_precision((campaign.unique_opens.to_f / campaign.requests.to_f) * 100, :precision => 2) %> %</td> | |
| <td><%= number_with_precision((campaign.unique_clicks.to_f / campaign.requests.to_f) * 100, :precision => 2) %> %</td> | |
| <td><%= number_with_precision(campaign.result, :precision => 0) %> </td> | |
| <td><%= number_with_precision(campaign.turnover, :precision => 2) %> €</td> | |
| <td><%= number_with_precision(campaign.cost, :precision => 2) %> €</td> | |
| <td><%= number_with_precision(campaign.ecpm, :precision => 2) %> €</td> | |
| <td><%= number_with_precision(campaign.margin, :precision => 2) %> €</td> | |
| <!-- <td><%= number_with_precision(campaign.roi, :precision => 2) %> €</td> --> | |
| </tr> | |
| <br> | |
| <% end %> | |
| </table> | |
| <div class="digg_pagination"> | |
| <%= will_paginate @wm_gmail_e_cia_all %> | |
| </div> | |
| </div> | |
| <% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def wm_sweep_abd_2k18_follow_up | |
| @wm_sweep_follow_up = SibTransac.where.not(campaign_name: nil).where(tag: "sweep-abd-2k18").paginate(:page => params[:page], :per_page => 10) | |
| @wm_sweep_follow_up_to_update = SibTransac.where(campaign_name: nil).where(tag: "sweep-abd-2k18").count | |
| @wm_sweep_follow_up_2 = SibTransac.where.not(campaign_name: nil).where(tag: "SWEEP-BEAU-ABD-2k18").paginate(:page => params[:page], :per_page => 10) | |
| @wm_sweep_follow_up_2_to_update = SibTransac.where.not(campaign_name: nil).where(tag: "SWEEP-BEAU-ABD-2k18").count | |
| @wm_sweep_follow_up_all = @wm_sweep_follow_up.merge(@wm_sweep_follow_up_2) | |
| @wm_sweep_follow_up_all_to_update = @wm_sweep_follow_up_to_update + @wm_sweep_follow_up_2_to_update | |
| def kpi(campaigns) | |
| { | |
| requests: campaigns.sum(:requests), | |
| orate: (campaigns.sum(:unique_opens).to_f / campaigns.sum(:requests).to_f) * 100, | |
| crate: (campaigns.sum(:unique_clicks).to_f / campaigns.sum(:requests).to_f) * 100, | |
| turnover: campaigns.sum(:turnover), | |
| cost: campaigns.sum(:cost), | |
| margin: campaigns.sum(:margin), | |
| unique_opens: campaigns.sum(:unique_opens), | |
| unique_clicks: campaigns.sum(:unique_clicks), | |
| ecpm: (campaigns.sum(:turnover) / campaigns.sum(:requests)) * 100 | |
| } | |
| end | |
| wm_sweep_follow_up_month = kpi(SibTransac.where(tag: "sweep-abd-2k18").where.not(orate: Float::NAN).from_this_month) | |
| wm_sweep_follow_up_2_month = kpi(SibTransac.where(tag: "SWEEP-BEAU-ABD-2k18").where.not(orate: Float::NAN).from_this_month) | |
| @wm_sweep_follow_up_month_all = wm_sweep_follow_up_month.merge(wm_sweep_follow_up_2_month){ |k, wm_sweep_follow_up_month_value, wm_sweep_follow_up_2_month_value| wm_sweep_follow_up_month_value + wm_sweep_follow_up_2_month_value } | |
| end | |
| def wm_gmail_e_cia | |
| @wm_gmail_e_cia = SibTransac.where.not(campaign_name: nil).where(tag: "WM-ABD-2018-GMAIL-E-CIA").paginate(:page => params[:page], :per_page => 10).sorted | |
| @wm_gmail_e_cia_to_update = SibTransac.where(campaign_name: nil).where(tag: "WM-ABD-2018-GMAIL-E-CIA").count | |
| @wm_gmail_e_cia_collecte = SibTransac.where.not(campaign_name: nil).where(tag: "WM-ABD-2018-GMAIL-E-CIA-COLLECTE").paginate(:page => params[:page], :per_page => 10).sorted | |
| @wm_gmail_e_cia_collecte_to_update = SibTransac.where(campaign_name: nil).where(tag: "WM-ABD-2018-GMAIL-E-CIA-COLLECTE").count | |
| @wm_gmail_e_cia_all = @wm_gmail_e_cia.merge(@wm_gmail_e_cia_collecte) | |
| @wm_gmail_e_cia_all_to_update = @wm_gmail_e_cia_to_update + @wm_gmail_e_cia_collecte_to_update | |
| def kpi(campaigns) | |
| { | |
| requests: campaigns.sum(:requests), | |
| orate: (campaigns.sum(:unique_opens).to_f / campaigns.sum(:requests).to_f) * 100, | |
| crate: (campaigns.sum(:unique_clicks).to_f / campaigns.sum(:requests).to_f) * 100, | |
| turnover: campaigns.sum(:turnover), | |
| cost: campaigns.sum(:cost), | |
| margin: campaigns.sum(:margin), | |
| unique_opens: campaigns.sum(:unique_opens), | |
| unique_clicks: campaigns.sum(:unique_clicks), | |
| ecpm: (campaigns.sum(:turnover) / campaigns.sum(:requests)) * 100 | |
| } | |
| end | |
| wm_gmail_e_cia_month = kpi(SibTransac.where(tag: "WM-ABD-2018-GMAIL-E-CIA").where.not(orate: Float::NAN).from_this_month) | |
| wm_gmail_e_cia_collecte_month = kpi(SibTransac.where(tag: "WM-ABD-2018-GMAIL-E-CIA-COLLECTE").where.not(orate: Float::NAN).from_this_month) | |
| @wm_gmail_e_cia_all_month = wm_gmail_e_cia_month.merge(wm_gmail_e_cia_collecte_month){ |k, wm_gmail_e_cia_month_value, wm_gmail_e_cia_collecte_month_value| wm_gmail_e_cia_month_value + wm_gmail_e_cia_collecte_month_value } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <p id="notice"><%= notice %></p> | |
| <!-- Defines which Navigation menu will be displayed based on current user status --> | |
| <% if current_user.admin? %> | |
| <div><%= render "admins_transac_navigation" %></div> | |
| <% else %> | |
| <div><%= render "users_transac_navigation" %></div> | |
| <% end %> | |
| <!-- This is what is being displayed to Admin Users (all info about all databases) --> | |
| <% if current_user.admin? %> | |
| <center> | |
| <h1>Details for Sweep Beauty Follow Up</h1> | |
| <br> | |
| <div class="row"> | |
| <div class="col-sm-4"> | |
| <table class="monet-table"> | |
| <tr> | |
| <th colspan="7">Month Recap Sweep Beauty Follow Up</th> | |
| </tr> | |
| <tr> | |
| <td>Month</td> | |
| <td>Open Rate</td> | |
| <td>Click Rate</td> | |
| <td>Margin</td> | |
| <td>eCPM</td> | |
| <td>Activated</td> | |
| </tr> | |
| <tr> | |
| <td><%= Date.today.strftime("%m") %></td> | |
| <td><%= number_with_precision(@wm_sweep_follow_up_month_all[:orate], :precision => 2) %> %</td> | |
| <td><%= number_with_precision(@wm_sweep_follow_up_month_all[:crate], :precision => 2) %> %</td> | |
| <td><%= number_with_precision(@wm_sweep_follow_up_month_all[:margin], :precision => 2) %> €</td> | |
| <td><%= number_with_precision(@wm_sweep_follow_up_month_all[:ecpm], :precision => 2) %> €</td> | |
| <td><%= number_with_precision(@wm_sweep_follow_up_month_all[:unique_opens], :precision => 0) %></td> | |
| </tr> | |
| </table> | |
| </div> | |
| </div> | |
| </center> | |
| <div class="row"> | |
| <table class="monet-table"> | |
| <tr> | |
| <th colspan="13">Campaigns to be updated: <%= @wm_sweep_follow_up_all_to_update %></th> | |
| </tr> | |
| <tr> | |
| <th> </th> | |
| <th> </th> | |
| <th> TAG</th> | |
| <th> Date</th> | |
| <th> Volume</th> | |
| <th> Delivered</th> | |
| <th> Open Rate</th> | |
| <th> Click Rate</th> | |
| <th> Result</th> | |
| <th> Turn Over</th> | |
| <th> Cost</th> | |
| <th> eCPM</th> | |
| <th> Margin</th> | |
| <!-- <th> ROI</th> --> | |
| </tr> | |
| <tr> | |
| <th> Filter:</th> | |
| <th> </th> | |
| <th> </th> | |
| <th><%= link_to '⇑', {:controller => 'campaign', :action => 'camp_newest', order: 'by_date_newest'} %> | <%= link_to '⇓', {:controller => 'campaign', :action => 'camp_oldest', order: 'by_date_oldest'} %></th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| </tr> | |
| <% @wm_sweep_follow_up_month_all.each do |campaign| %> | |
| <tr> | |
| <td><%= link_to(image_tag("eyeicon.png", :size => '25x25', :alt => "details"), {:action => 'show', :id => campaign.id}, :class => 'back-link') %></td> | |
| <td><%= link_to(image_tag("pencil.png", :size => '25x25', :alt => "details"), {:action => 'edit', :id => campaign.id}, :class => 'back-link') %></td> | |
| <td><%= campaign.tag %></td> | |
| <td><%= campaign.date %></td> | |
| <td><%= campaign.requests %></td> | |
| <td><%= campaign.delivered %></td> | |
| <td><%= number_with_precision((campaign.unique_opens.to_f / campaign.requests.to_f) * 100, :precision => 2) %> %</td> | |
| <td><%= number_with_precision((campaign.unique_clicks.to_f / campaign.requests.to_f) * 100, :precision => 2) %> %</td> | |
| <td><%= number_with_precision(campaign.result, :precision => 0) %> </td> | |
| <td><%= number_with_precision(campaign.turnover, :precision => 2) %> €</td> | |
| <td><%= number_with_precision(campaign.cost, :precision => 2) %> €</td> | |
| <td><%= number_with_precision(campaign.ecpm, :precision => 2) %> €</td> | |
| <td><%= number_with_precision(campaign.margin, :precision => 2) %> €</td> | |
| <!-- <td><%= number_with_precision(campaign.roi, :precision => 2) %> €</td> --> | |
| </tr> | |
| <br> | |
| <% end %> | |
| </table> | |
| <div class="digg_pagination"> | |
| <%= will_paginate @wm_sweep_follow_up_month_all %> | |
| </div> | |
| </div> | |
| </center> | |
| </div> | |
| <br /> | |
| <!-- Template for Admin ends here --> | |
| <% else %> | |
| <!-- Template for other users starts here (only has information on ABD 2K18) --> | |
| <center> | |
| <h1>Details for Sweep Beauty Follow Up</h1> | |
| <br> | |
| <div class="row"> | |
| <div class="col-sm-4"> | |
| <table class="monet-table"> | |
| <tr> | |
| <th colspan="7">Month Recap Sweep Beauty Follow Up</th> | |
| </tr> | |
| <tr> | |
| <td>Month</td> | |
| <td>Open Rate</td> | |
| <td>Click Rate</td> | |
| <td>Margin</td> | |
| <td>eCPM</td> | |
| <td>Activated</td> | |
| </tr> | |
| <tr> | |
| <td><%= Date.today.strftime("%m") %></td> | |
| <td><%= number_with_precision(@wm_sweep_follow_up_month_all[:orate], :precision => 2) %> %</td> | |
| <td><%= number_with_precision(@wm_sweep_follow_up_month_all[:crate], :precision => 2) %> %</td> | |
| <td><%= number_with_precision(@wm_sweep_follow_up_month_all[:margin], :precision => 2) %> €</td> | |
| <td><%= number_with_precision(@wm_sweep_follow_up_month_all[:ecpm], :precision => 2) %> €</td> | |
| <td><%= number_with_precision(@wm_sweep_follow_up_month_all[:unique_opens], :precision => 0) %></td> | |
| </tr> | |
| </table> | |
| </div> | |
| </div> | |
| </center> | |
| <div class="row"> | |
| <table class="monet-table"> | |
| <tr> | |
| <th colspan="13">Campaigns to be updated: <%= @wm_sweep_follow_up_all_to_update %></th> | |
| </tr> | |
| <tr> | |
| <th> </th> | |
| <th> </th> | |
| <th> TAG</th> | |
| <th> Date</th> | |
| <th> Volume</th> | |
| <th> Delivered</th> | |
| <th> Open Rate</th> | |
| <th> Click Rate</th> | |
| <th> Result</th> | |
| <th> Turn Over</th> | |
| <th> Cost</th> | |
| <th> eCPM</th> | |
| <th> Margin</th> | |
| <!-- <th> ROI</th> --> | |
| </tr> | |
| <tr> | |
| <th> Filter:</th> | |
| <th> </th> | |
| <th> </th> | |
| <th><%= link_to '⇑', {:controller => 'campaign', :action => 'camp_newest', order: 'by_date_newest'} %> | <%= link_to '⇓', {:controller => 'campaign', :action => 'camp_oldest', order: 'by_date_oldest'} %></th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| <th> </th> | |
| </tr> | |
| <% @wm_sweep_follow_up_month_all.each do |campaign| %> | |
| <tr> | |
| <td><%= link_to(image_tag("eyeicon.png", :size => '25x25', :alt => "details"), {:action => 'show', :id => campaign.id}, :class => 'back-link') %></td> | |
| <td><%= link_to(image_tag("pencil.png", :size => '25x25', :alt => "details"), {:action => 'edit', :id => campaign.id}, :class => 'back-link') %></td> | |
| <td><%= campaign.tag %></td> | |
| <td><%= campaign.date %></td> | |
| <td><%= campaign.requests %></td> | |
| <td><%= campaign.delivered %></td> | |
| <td><%= number_with_precision((campaign.unique_opens.to_f / campaign.requests.to_f) * 100, :precision => 2) %> %</td> | |
| <td><%= number_with_precision((campaign.unique_clicks.to_f / campaign.requests.to_f) * 100, :precision => 2) %> %</td> | |
| <td><%= number_with_precision(campaign.result, :precision => 0) %> </td> | |
| <td><%= number_with_precision(campaign.turnover, :precision => 2) %> €</td> | |
| <td><%= number_with_precision(campaign.cost, :precision => 2) %> €</td> | |
| <td><%= number_with_precision(campaign.ecpm, :precision => 2) %> €</td> | |
| <td><%= number_with_precision(campaign.margin, :precision => 2) %> €</td> | |
| <!-- <td><%= number_with_precision(campaign.roi, :precision => 2) %> €</td> --> | |
| </tr> | |
| <br> | |
| <% end %> | |
| </table> | |
| <div class="digg_pagination"> | |
| <%= will_paginate @wm_sweep_follow_up_month_all %> | |
| </div> | |
| </div> | |
| </center> | |
| </div> | |
| <br /> | |
| <% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def kpi(campaigns) | |
| { | |
| requests: campaigns.sum(:requests), | |
| orate: (campaigns.sum(:unique_opens).to_f / campaigns.sum(:requests).to_f) * 100, | |
| crate: (campaigns.sum(:unique_clicks).to_f / campaigns.sum(:requests).to_f) * 100, | |
| turnover: campaigns.sum(:turnover), | |
| cost: campaigns.sum(:cost), | |
| margin: campaigns.sum(:margin), | |
| unique_opens: campaigns.sum(:unique_opens), | |
| unique_clicks: campaigns.sum(:unique_clicks), | |
| ecpm: (campaigns.sum(:turnover) / campaigns.sum(:requests)) * 100 | |
| } | |
| end | |
| wm_sweep_follow_up_month = kpi(SibTransac.where(tag: "sweep-abd-2k18").where.not(orate: Float::NAN).from_this_month) | |
| wm_sweep_follow_up_2_month = kpi(SibTransac.where(tag: "SWEEP-BEAU-ABD-2k18").where.not(orate: Float::NAN).from_this_month) | |
| @wm_sweep_follow_up_month_all = wm_sweep_follow_up_month.merge(wm_sweep_follow_up_2_month){ |k, wm_sweep_follow_up_month_value, wm_sweep_follow_up_2_month_value| wm_sweep_follow_up_month_value + wm_sweep_follow_up_2_month_value } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def kpi(campaigns) | |
| { | |
| requests: campaigns.sum(:requests), | |
| orate: (campaigns.sum(:unique_opens).to_f / campaigns.sum(:requests).to_f) * 100, | |
| crate: (campaigns.sum(:unique_clicks).to_f / campaigns.sum(:requests).to_f) * 100, | |
| turnover: campaigns.sum(:turnover), | |
| cost: campaigns.sum(:cost), | |
| margin: campaigns.sum(:margin), | |
| unique_opens: campaigns.sum(:unique_opens), | |
| unique_clicks: campaigns.sum(:unique_clicks), | |
| ecpm: (campaigns.sum(:turnover) / campaigns.sum(:requests)) * 100 | |
| } | |
| end | |
| wm_gmail_e_cia_month = kpi(SibTransac.where(tag: "WM-ABD-2018-GMAIL-E-CIA").where.not(orate: Float::NAN).from_this_month) | |
| wm_gmail_e_cia_collecte_month = kpi(SibTransac.where(tag: "WM-ABD-2018-GMAIL-E-CIA-COLLECTE").where.not(orate: Float::NAN).from_this_month) | |
| @wm_gmail_e_cia_all_month = wm_gmail_e_cia_month.merge(wm_gmail_e_cia_collecte_month){ |k, wm_gmail_e_cia_month_value, wm_gmail_e_cia_collecte_month_value| wm_gmail_e_cia_month_value + wm_gmail_e_cia_collecte_month_value } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <% @wm_gmail_e_cia_all.each do |campaign| %> | |
| <tr> | |
| <td><%= campaign.tag %></td> | |
| </tr> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <% @wm_sweep_follow_up_month_all.each do |campaign| %> | |
| <tr> | |
| <td><%= campaign.tag %></td> | |
| </tr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment