mountain-goat 0.1.8 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. data/README.md +119 -48
  2. data/generators/mg/mg_generator.rb +17 -9
  3. data/generators/mg/templates/create_mountain_goat_tables.rb +61 -25
  4. data/generators/mg/templates/mg.rb +1 -0
  5. data/generators/mg/templates/mountain-goat.yml +22 -3
  6. data/generators/mg/templates/mountain_goat_reports.rake +17 -0
  7. data/generators/mg/templates/update_mountain_goat_tables.rb +104 -0
  8. data/lib/mountain-goat.rb +21 -12
  9. data/lib/mountain-goat/analytics.rb +134 -0
  10. data/lib/mountain-goat/controllers/{mountain_goat/mountain_goat_converts_controller.rb → mg/converts_controller.rb} +12 -11
  11. data/lib/mountain-goat/controllers/{mountain_goat/mountain_goat_metric_variants_controller.rb → mg/metric_variants_controller.rb} +6 -5
  12. data/lib/mountain-goat/controllers/{mountain_goat/mountain_goat_metrics_controller.rb → mg/metrics_controller.rb} +8 -6
  13. data/lib/mountain-goat/controllers/mg/mg.rb +47 -0
  14. data/lib/mountain-goat/controllers/{mountain_goat → mg}/mountain_goat_controller.rb +5 -42
  15. data/lib/mountain-goat/controllers/mg/playground_controller.rb +8 -0
  16. data/lib/mountain-goat/controllers/{mountain_goat/mountain_goat_rallies_controller.rb → mg/rallies_controller.rb} +4 -26
  17. data/lib/mountain-goat/controllers/mg/report_items_controller.rb +82 -0
  18. data/lib/mountain-goat/controllers/mg/reports_controller.rb +90 -0
  19. data/lib/mountain-goat/m_g.rb +64 -0
  20. data/lib/mountain-goat/metric_tracking.rb +192 -74
  21. data/lib/mountain-goat/models/mg/ci_meta.rb +10 -0
  22. data/lib/mountain-goat/models/mg/convert.rb +147 -0
  23. data/lib/mountain-goat/models/mg/convert_meta_type.rb +20 -0
  24. data/lib/mountain-goat/models/mg/cs_meta.rb +10 -0
  25. data/lib/mountain-goat/models/{metric.rb → mg/metric.rb} +3 -5
  26. data/lib/mountain-goat/models/mg/metric_variant.rb +25 -0
  27. data/lib/mountain-goat/models/mg/mountain_goat.rb +3 -0
  28. data/lib/mountain-goat/models/{rally.rb → mg/rally.rb} +4 -3
  29. data/lib/mountain-goat/models/mg/report.rb +11 -0
  30. data/lib/mountain-goat/models/mg/report_item.rb +24 -0
  31. data/lib/mountain-goat/models/mg/report_mailer.rb +18 -0
  32. data/lib/mountain-goat/public/g-bar-min.js +7 -0
  33. data/lib/mountain-goat/public/g-dot-min.js +7 -0
  34. data/lib/mountain-goat/public/g-line-min.js +7 -0
  35. data/lib/mountain-goat/public/g-pie-min.js +1 -0
  36. data/lib/mountain-goat/public/g-raphael-min.js +7 -0
  37. data/lib/mountain-goat/public/jqModel.css +41 -0
  38. data/lib/mountain-goat/public/jqModel.js +69 -0
  39. data/lib/mountain-goat/public/jquery.raphael.js +208 -0
  40. data/lib/mountain-goat/public/mg.css +135 -26
  41. data/lib/mountain-goat/public/mg.js +53 -1
  42. data/lib/mountain-goat/public/raphael-min.js +7 -0
  43. data/lib/mountain-goat/public/utils.js +520 -0
  44. data/lib/mountain-goat/switch_variant.rb +4 -4
  45. data/lib/mountain-goat/version.rb +1 -1
  46. data/lib/mountain-goat/views/mountain_goat/layouts/_pdf.html.erb +15 -0
  47. data/lib/mountain-goat/views/mountain_goat/layouts/mountain_goat.html.erb +17 -5
  48. data/lib/mountain-goat/views/mountain_goat/layouts/xhr.html.erb +2 -0
  49. data/lib/mountain-goat/views/mountain_goat/{mountain_goat_converts → mg/converts}/.tmp_show.html.erb.4433~ +0 -0
  50. data/lib/mountain-goat/views/mountain_goat/{mountain_goat_converts → mg/converts}/_convert_form.html.erb +0 -0
  51. data/lib/mountain-goat/views/mountain_goat/{mountain_goat_converts → mg/converts}/_convert_meta_type_form.html.erb +0 -0
  52. data/lib/mountain-goat/views/mountain_goat/mg/converts/edit.html.erb +13 -0
  53. data/lib/mountain-goat/views/mountain_goat/mg/converts/index.html.erb +25 -0
  54. data/lib/mountain-goat/views/mountain_goat/mg/converts/new.html.erb +13 -0
  55. data/lib/mountain-goat/views/mountain_goat/{mountain_goat_converts → mg/converts}/show.html.erb +3 -28
  56. data/lib/mountain-goat/views/mountain_goat/{mountain_goat_metric_variants → mg/metric_variants}/_metric_variant_form.html.erb +0 -4
  57. data/lib/mountain-goat/views/mountain_goat/mg/metric_variants/edit.html.erb +13 -0
  58. data/lib/mountain-goat/views/mountain_goat/{mountain_goat_metric_variants → mg/metric_variants}/index.html.erb +3 -3
  59. data/lib/mountain-goat/views/mountain_goat/mg/metric_variants/new.html.erb +15 -0
  60. data/lib/mountain-goat/views/mountain_goat/{mountain_goat_metric_variants → mg/metric_variants}/show.html.erb +4 -5
  61. data/lib/mountain-goat/views/mountain_goat/{mountain_goat_metrics → mg/metrics}/.tmp_show.html.erb.21270~ +0 -0
  62. data/lib/mountain-goat/views/mountain_goat/{mountain_goat_metrics → mg/metrics}/_metric_form.html.erb +0 -2
  63. data/lib/mountain-goat/views/mountain_goat/mg/metrics/edit.html.erb +13 -0
  64. data/lib/mountain-goat/views/mountain_goat/mg/metrics/index.html.erb +14 -0
  65. data/lib/mountain-goat/views/mountain_goat/mg/metrics/new.html.erb +14 -0
  66. data/lib/mountain-goat/views/mountain_goat/{mountain_goat_metrics → mg/metrics}/show.html.erb +7 -8
  67. data/lib/mountain-goat/views/mountain_goat/{mountain_goat → mg/mountain_goat}/login.html.erb +0 -0
  68. data/lib/mountain-goat/views/mountain_goat/mg/playground/test.html.erb +14 -0
  69. data/lib/mountain-goat/views/mountain_goat/{mountain_goat_rallies → mg/rallies}/.tmp__rally.html.erb.40484~ +0 -0
  70. data/lib/mountain-goat/views/mountain_goat/mg/rallies/_rallies.html.erb +5 -0
  71. data/lib/mountain-goat/views/mountain_goat/{mountain_goat_rallies → mg/rallies}/_rallies_form.html.erb +0 -0
  72. data/lib/mountain-goat/views/mountain_goat/{mountain_goat_rallies → mg/rallies}/_rally.html.erb +0 -0
  73. data/lib/mountain-goat/views/mountain_goat/mg/rallies/edit.html.erb +13 -0
  74. data/lib/mountain-goat/views/mountain_goat/{mountain_goat_rallies → mg/rallies}/index.html.erb +1 -1
  75. data/lib/mountain-goat/views/mountain_goat/mg/rallies/new.html.erb +13 -0
  76. data/lib/mountain-goat/views/mountain_goat/{mountain_goat_rallies → mg/rallies}/show.html.erb +1 -1
  77. data/lib/mountain-goat/views/mountain_goat/mg/report_items/_chart.html.erb +18 -0
  78. data/lib/mountain-goat/views/mountain_goat/mg/report_items/_report_item_form.html.erb +10 -0
  79. data/lib/mountain-goat/views/mountain_goat/mg/report_items/_report_item_pivot_form.html.erb +14 -0
  80. data/lib/mountain-goat/views/mountain_goat/mg/report_items/_show.html.erb +29 -0
  81. data/lib/mountain-goat/views/mountain_goat/mg/report_items/_svg_chart.html.erb +4 -0
  82. data/lib/mountain-goat/views/mountain_goat/mg/report_items/edit.html.erb +19 -0
  83. data/lib/mountain-goat/views/mountain_goat/mg/report_items/new.html.erb +17 -0
  84. data/lib/mountain-goat/views/mountain_goat/mg/report_mailer/report.html.erb +27 -0
  85. data/lib/mountain-goat/views/mountain_goat/mg/reports/_report.html.erb +22 -0
  86. data/lib/mountain-goat/views/mountain_goat/mg/reports/_report_form.html.erb +21 -0
  87. data/lib/mountain-goat/views/mountain_goat/mg/reports/_report_report_items.html.erb +5 -0
  88. data/lib/mountain-goat/views/mountain_goat/mg/reports/edit.html.erb +36 -0
  89. data/lib/mountain-goat/views/mountain_goat/mg/reports/index.html.erb +26 -0
  90. data/lib/mountain-goat/views/mountain_goat/mg/reports/new.html.erb +17 -0
  91. data/lib/mountain-goat/views/mountain_goat/mg/reports/show.html.erb +21 -0
  92. data/test/fixtures/{ci_metas.yml → mg_ci_metas.yml} +0 -0
  93. data/test/fixtures/{convert_meta_types.yml → mg_convert_meta_types.yml} +0 -0
  94. data/test/fixtures/{converts.yml → mg_converts.yml} +5 -0
  95. data/test/fixtures/{cs_metas.yml → mg_cs_metas.yml} +0 -0
  96. data/test/fixtures/mg_deliveries.yml +9 -0
  97. data/test/fixtures/{metric_variants.yml → mg_metric_variants.yml} +0 -0
  98. data/test/fixtures/{metrics.yml → mg_metrics.yml} +2 -3
  99. data/test/fixtures/{rallies.yml → mg_rallies.yml} +6 -2
  100. data/test/fixtures/mg_report_items.yml +13 -0
  101. data/test/fixtures/mg_reports.yml +15 -0
  102. data/test/mg_convert_test.rb +32 -0
  103. data/test/mg_converts_controller_test.rb +47 -0
  104. data/test/mg_metric_variants_controller_test.rb +46 -0
  105. data/test/mg_metrics_controller_test.rb +52 -0
  106. data/test/mg_mountain_goat_controller_test.rb +45 -0
  107. data/test/mg_mountain_goat_test.rb +392 -0
  108. data/test/mg_playground_controller_test.rb +11 -0
  109. data/test/mg_rallies_controller_test.rb +36 -0
  110. data/test/mg_report_item_test.rb +7 -0
  111. data/test/mg_report_items_controller_test.rb +31 -0
  112. data/test/mg_report_test.rb +18 -0
  113. data/test/mg_reports_controller_test.rb +50 -0
  114. data/test/test_helper.rb +203 -0
  115. metadata +108 -55
  116. data/lib/mountain-goat/models/ci_meta.rb +0 -9
  117. data/lib/mountain-goat/models/convert.rb +0 -70
  118. data/lib/mountain-goat/models/convert_meta_type.rb +0 -19
  119. data/lib/mountain-goat/models/cs_meta.rb +0 -9
  120. data/lib/mountain-goat/models/metric_variant.rb +0 -22
  121. data/lib/mountain-goat/views/mountain_goat/mountain_goat_converts/edit.html.erb +0 -13
  122. data/lib/mountain-goat/views/mountain_goat/mountain_goat_converts/index.html.erb +0 -48
  123. data/lib/mountain-goat/views/mountain_goat/mountain_goat_converts/new.html.erb +0 -13
  124. data/lib/mountain-goat/views/mountain_goat/mountain_goat_metric_variants/edit.html.erb +0 -13
  125. data/lib/mountain-goat/views/mountain_goat/mountain_goat_metric_variants/new.html.erb +0 -15
  126. data/lib/mountain-goat/views/mountain_goat/mountain_goat_metrics/edit.html.erb +0 -13
  127. data/lib/mountain-goat/views/mountain_goat/mountain_goat_metrics/index.html.erb +0 -14
  128. data/lib/mountain-goat/views/mountain_goat/mountain_goat_metrics/new.html.erb +0 -14
  129. data/lib/mountain-goat/views/mountain_goat/mountain_goat_rallies/_rallies.html.erb +0 -5
  130. data/lib/mountain-goat/views/mountain_goat/mountain_goat_rallies/edit.html.erb +0 -13
  131. data/lib/mountain-goat/views/mountain_goat/mountain_goat_rallies/new.html.erb +0 -13
  132. data/test/ocelot_converts_controller_test.rb +0 -45
  133. data/test/ocelot_metric_variants_controller_test.rb +0 -45
  134. data/test/ocelot_metrics_controller_test.rb +0 -45
  135. data/test/ocelot_rallies_controller_test.rb +0 -8
@@ -3,7 +3,7 @@
3
3
  <div class="mountain-goat-panel">
4
4
  <h1>Rallies <% if @convert %>for <%=h @convert.name %><% else %>for all Goals<% end %></h1>
5
5
 
6
- <div class="recent-rally" data-reload="true" data-rally-id="<%= @rallies.first.id %>" data-convert-id="<%= @convert ? @convert.id : '' %>"></div>
6
+ <div class="recent-rally" data-reload="true" data-rally-id="<%= @rallies.count > 0 ? @rallies.first.id : -1 %>" data-convert-id="<%= @convert ? @convert.id : '' %>"></div>
7
7
  <a href="javascript:void(0)" class="reload">Reload</a>
8
8
 
9
9
  <% if @rallies.count > 0 %>
@@ -0,0 +1,13 @@
1
+
2
+ <div id="container-main" class="mt-rallies">
3
+ <div class="mountain-goat-panel cenetered">
4
+ <h2>New rally</h2>
5
+
6
+ <% form_for :rally, @rally, :url => mg_rallies_url do |f| %>
7
+ <%= f.error_messages %>
8
+
9
+ <%= render :partial => 'mg/rallies/rallies_form', :locals => { :f => f } %>
10
+ <% end %>
11
+
12
+ </div>
13
+ </div>
@@ -8,7 +8,7 @@
8
8
  </div>
9
9
 
10
10
  <div class="actions">
11
- <a class="button" href="<%= edit_mountain_goat_rally_url @rally.id %>">Edit</a>
11
+ <a class="button" href="<%= edit_mg_rally_url @rally.id %>">Edit</a>
12
12
  </div>
13
13
  </div>
14
14
  </div>
@@ -0,0 +1,18 @@
1
+ <%# locals => report_item %>
2
+
3
+ <div class="statpad">
4
+ <div class="title"><%= report_item.chart_title %></div>
5
+ <div class="statbody">
6
+ <div id="chart_item<%=h report_item.id %>" data-raphael="line" data-x-axis="date"
7
+ <% it = 0 %>
8
+ <%# TODO: There's a ton of assumptions here %>
9
+ <% report_item.chart_items.each do |name, channel| %>
10
+ data-title<%= it %>="<%= name || "Direct" %>"
11
+ data-x<%= it %>="<%= channel.map { |i| i[:x].to_time.to_i * 1000 }.join(',') %>"
12
+ data-y<%= it %>="<%= channel.map { |i| i[:y] }.join(',') %>"
13
+ <% it = it + 1 %>
14
+ <% end %>
15
+ style="width: 425px; height: 260px;" />
16
+ </div>
17
+ </div>
18
+ </div>
@@ -0,0 +1,10 @@
1
+ <%# locals => f %>
2
+ <div class="item reportable">
3
+ <%= f.label :reportable, "Report Item" %>
4
+ <%= f.select :reportable, options_for_select( [[ "Select a Goal", "" ]] + Mg::Convert.all.map { |conv| [ conv.name, "#{conv.id}-#{conv.class}" ] }, f.object.reportable.nil? ? "" : "#{f.object.reportable_id}-#{f.object.reportable_type}" ), {}, :'data-varies' => 'change', :'data-varies-path' => get_extra_mg_report_items_url, :'data-varies-res' => '#extra' %>
5
+ </div>
6
+ <div id="extra">
7
+ <% if !f.object.nil? && !f.object.reportable.nil? %>
8
+ <%= render :partial => 'mg/report_items/report_item_pivot_form', :locals => { :reportable => f.object.reportable }.merge( f.object.pivot.nil? ? {} : { :pivot => f.object.pivot } ) %>
9
+ <% end %>
10
+ </div>
@@ -0,0 +1,14 @@
1
+ <%# locals => reportable, optional => pivot %>
2
+
3
+ <% pivot = nil if !local_assigns.has_key?(:pivot) %>
4
+
5
+ <% if reportable.instance_of?(Mg::Convert) %>
6
+ <% cmts = reportable.convert_meta_types %>
7
+ <% end %>
8
+
9
+ <% if !cmts.nil? %>
10
+ <div class="item pivot">
11
+ <%= label_tag :'report_item[pivot]', "Pivot" %>
12
+ <%= select_tag :'report_item[pivot]', options_for_select( [[ "None", "" ]] + cmts.map { |cmt| [ cmt.name, "#{cmt.id}-#{cmt.class}" ] }, pivot.nil? ? "" : "#{pivot.id}-#{pivot.type}" ) %>
13
+ </div>
14
+ <% end %>
@@ -0,0 +1,29 @@
1
+ <%# locals => report_item %>
2
+
3
+ <div class="report-item">
4
+ <span class="report-info">
5
+ <span class="report">
6
+ <% if report_item.reportable.nil? || !report_item.reportable.respond_to?(:name) %>
7
+ &lt;Undefined&gt;
8
+ <% else %>
9
+ <%= report_item.reportable.name %>
10
+ <% end %>
11
+ </span>
12
+ <span class="pivot">
13
+ <% if report_item.pivot.nil? || !report_item.pivot.respond_to?(:name) %>
14
+ [None]
15
+ <% else %>
16
+ <%= report_item.pivot.name %>
17
+ <% end %>
18
+ </span>
19
+ </span>
20
+ <span class="report-item-actions">
21
+ <span class="edit">
22
+ <a href="javascript:void(0)" class="remote-link smallbutton" data-path="<%= edit_mg_report_item_url(:id => report_item.id) %>" data-res=".report-items-model .model">Edit</a>
23
+ </span>
24
+
25
+ <span class="remove">
26
+ <a href="javascript:void(0)" class="remote-link smallbutton" data-path="<%= destroy_mg_report_item_url(:id => report_item.id) %>" data-res=".report-items-model .model">Remove</a>
27
+ </span>
28
+ </span>
29
+ </div>
@@ -0,0 +1,4 @@
1
+ <%# locals => report_item %>
2
+
3
+ <% res = report_item.gerbil_chart.burn %>
4
+ <%= res[res.index("<svg")..res.length] %>
@@ -0,0 +1,19 @@
1
+
2
+ <div class="header">
3
+ <span class="title">Edit Report Item</span>
4
+ </div>
5
+ <div class="body">
6
+ <div class="report-items">
7
+ <% form_for :report_item, @report_item, :url => update_mg_report_item_url(:id => @report_item.id), :html => { :method => :post, :class => "remote-form report-item", :'data-res' => ".report-items-model .model" } do |f| %>
8
+
9
+ <div>
10
+ <%= f.error_messages %>
11
+ <%= render :partial => 'mg/report_items/report_item_form', :locals => { :f => f } %>
12
+ </div>
13
+
14
+ <div class="submit">
15
+ <%= f.submit 'Update', :class => 'bluebutton' %>
16
+ </div>
17
+ <% end %>
18
+ </div>
19
+ </div>
@@ -0,0 +1,17 @@
1
+
2
+ <div class="header">
3
+ <span class="title">Add a new Report Item</span>
4
+ </div>
5
+ <div class="body">
6
+ <% form_for :report_item, @report_item, :url => mg_report_report_items_url(:report_id => @report.id), :html => { :method => :post, :class => "remote-form report-item", :'data-res' => ".report-items-model .model" } do |f| %>
7
+
8
+ <div>
9
+ <%= f.error_messages %>
10
+ <%= render :partial => 'mg/report_items/report_item_form', :locals => { :f => f } %>
11
+ </div>
12
+
13
+ <div class="submit">
14
+ <%= f.submit 'Save', :class => 'bluebutton' %>
15
+ </div>
16
+ <% end %>
17
+ </div>
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
6
+ </head>
7
+
8
+ <body style="font-family:Calibri,Arial,sans-serif; font-size: 16px;">
9
+
10
+ <div class="container-mailer">
11
+ <div class="mailer-content">
12
+ <div class="mailer-header">
13
+
14
+ </div>
15
+
16
+ <div class="mailer-text">
17
+ Your statistics for <%=h @report.title %> are attached.
18
+ </div>
19
+
20
+ <div class="mailer-signature">
21
+ <span>- Your friends at <a href="https://github.com/hayesgm/mountain_goat">Mountain Goat</a></span>
22
+ </div>
23
+ </div>
24
+ </div>
25
+
26
+ </body>
27
+ </html>
@@ -0,0 +1,22 @@
1
+ <%# locals => report %>
2
+
3
+ <style>
4
+
5
+ h2, h4 { text-align: center; }
6
+
7
+ .svg-chart {
8
+ width: 700px;
9
+ margin: 0 auto 30px auto;
10
+ }
11
+
12
+ </style>
13
+
14
+ <h2><%=h report.title %></h2>
15
+
16
+ <h4><%=h report.description %></h4>
17
+
18
+ <% report.report_items.each do |report_item| %>
19
+ <div class="svg-chart">
20
+ <%= render 'mg/report_items/svg_chart', :report_item => report_item %>
21
+ </div>
22
+ <% end %>
@@ -0,0 +1,21 @@
1
+ <%# locals => f %>
2
+
3
+ <div class="item title">
4
+ <%= f.label :title %>
5
+ <%= f.text_field :title %>
6
+ </div>
7
+
8
+ <div class="item description">
9
+ <%= f.label :description %>
10
+ <%= f.text_area :description %>
11
+ </div>
12
+
13
+ <div class="item delivert_set">
14
+ <%= f.label :delivery_set, 'Frequency' %>
15
+ <%= f.select :delivery_set, options_for_select( [ [ 'daily', 'daily' ], [ 'weekly', 'weekly' ], [ 'monthly', 'monthly' ] ] ) %>
16
+ </div>
17
+
18
+ <div class="item recipients">
19
+ <%= f.label :recipients, 'Recipients' %>
20
+ <%= f.text_area :recipients %>
21
+ </div>
@@ -0,0 +1,5 @@
1
+ <%# locals => report %>
2
+
3
+ <% report.report_items.each do |report_item| %>
4
+ <%= render :partial => 'mg/report_items/show', :locals => { :report_item => report_item } %>
5
+ <% end %>
@@ -0,0 +1,36 @@
1
+
2
+ <div id="container-main" class="mt-reports">
3
+ <div class="mountain-goat-panel centered">
4
+ <ul class="nav">
5
+ <li><a href="<%= mg_reports_url %>">Reports</a></li>
6
+ <li><a href="<%= mg_report_url @report.id %>"><%=h @report.title %></a></li>
7
+ </ul>
8
+
9
+ <h1>Edit <%= @report.title %></h1>
10
+
11
+ <% form_for :report, @report, :url => mg_report_url(:id => @report.id), :html => { :method => :put } do |f| %>
12
+ <%= f.error_messages %>
13
+
14
+ <div class="report-report-items">
15
+ <h4>Report Items</h4>
16
+ <%= render :partial => "mg/reports/report_report_items", :locals => { :report => @report } %>
17
+ </div>
18
+
19
+ <a href="javascript:void(0)" class="smallbutton redbutton remote-link" data-path="<%= new_mg_report_report_item_url(:report_id => @report.id) %>" data-res=".report-items-model .model">+ Add Item</a>
20
+
21
+ <%= render :partial => 'mg/reports/report_form', :locals => { :f => f } %>
22
+
23
+ <div class="item submit">
24
+ <%= f.submit 'Submit' %>
25
+ </div>
26
+
27
+ <div class="report-items-model flash-model model">
28
+ <div class="jqmWindow">
29
+ <a href="#" class="jqmClose">Close</a>
30
+ <div class="model" data-model=".jqmWindow"></div>
31
+ </div>
32
+ </div>
33
+ <% end %>
34
+ </div>
35
+ </div>
36
+
@@ -0,0 +1,26 @@
1
+
2
+ <div id="container-main" class="mt-reports show">
3
+ <div class="mountain-goat-panel centered">
4
+ <ul class="nav">
5
+ <li><a href="<%= mg_reports_url %>">Reports</a></li>
6
+ </ul>
7
+
8
+ <div class="reports">
9
+ <div class="explanation">
10
+ <span class="inner">
11
+ All of your reports are listed here. Reports will be delivered to all recipients on the schedule indicated.
12
+ </span>
13
+ </div>
14
+
15
+ <div class="reports">
16
+ <% @reports.each do |report| %>
17
+ <h2><a href="<%= mg_report_url :id => report.id %>"><%=h report.title %></a> [<a href="<%= edit_mg_report_url :id => report.id %>">edit</a>]</h2>
18
+ <% end %>
19
+ </div>
20
+ </div>
21
+
22
+ <div class="actions">
23
+ <a class="button" href="<%= new_mg_report_url %>">New Report</a>
24
+ </div>
25
+ </div>
26
+ </div>
@@ -0,0 +1,17 @@
1
+
2
+ <div id="container-main" class="mt-reports">
3
+ <div class="mountain-goat-panel cenetered">
4
+ <h1>New Report</h1>
5
+
6
+ <% form_for :report, @report, :url => mg_reports_url do |f| %>
7
+ <%= f.error_messages %>
8
+
9
+ <%= render :partial => 'mg/reports/report_form', :locals => { :f => f } %>
10
+
11
+ <div class="item submit">
12
+ <%= f.submit 'Submit' %>
13
+ </div>
14
+
15
+ <% end %>
16
+ </div>
17
+ </div>
@@ -0,0 +1,21 @@
1
+
2
+ <div id="container-main" class="mt-reports show">
3
+ <div class="mountain-goat-panel centered">
4
+ <ul class="nav">
5
+ <li><a href="<%= mg_reports_url %>">Reports</a></li>
6
+ <li><a href="<%= mg_report_url @report.id %>"><%=h @report.title %></a></li>
7
+ </ul>
8
+
9
+ <h2><%=h @report.title %></h2>
10
+
11
+ <h4><%=h @report.description %></h4>
12
+
13
+ <% @report.report_items.each do |report_item| %>
14
+ <%= render 'mg/report_items/chart', :report_item => report_item %>
15
+ <% end %>
16
+
17
+ <div class="actions">
18
+ <a class="button" href="<%= edit_mg_report_url @report %>">Edit</a>
19
+ </div>
20
+ </div>
21
+ </div>
File without changes
@@ -9,3 +9,8 @@ two:
9
9
  id: 234
10
10
  name: my second convert
11
11
  convert_type: convert_2
12
+
13
+ open_mail:
14
+ id: 345
15
+ name: open mail
16
+ convert_type: open_mail
File without changes
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ one:
4
+ frequency: MyString
5
+ recipients: MyText
6
+
7
+ two:
8
+ frequency: MyString
9
+ recipients: MyText
@@ -4,9 +4,8 @@ one:
4
4
  id: 123
5
5
  metric_type: my_metric1
6
6
  title: MyString
7
- convert_id: 123
7
+
8
8
  two:
9
9
  id: 234
10
10
  metric_type: my_metric2
11
- title: MyString
12
- convert_id: 234
11
+ title: MyString
@@ -1,7 +1,11 @@
1
1
  # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
2
 
3
3
  one:
4
- convert_id: 1
4
+ convert_id: 123
5
5
 
6
6
  two:
7
- convert_id: 1
7
+ convert_id: 123
8
+
9
+ three:
10
+ convert_id: 234
11
+
@@ -0,0 +1,13 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ one:
4
+ report_id: 123
5
+ reportable_id: 123
6
+ reportable_type: Mg::Convert
7
+ order: 1
8
+
9
+ two:
10
+ report_id: 234
11
+ reportable_id: 234
12
+ reportable_type: Mg::Convert
13
+ order: 1
@@ -0,0 +1,15 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ one:
4
+ id: 123
5
+ title: MyString
6
+ description: MyText
7
+ delivery_set: daily
8
+ recipients: gg@ggg.com
9
+
10
+ two:
11
+ id: 234
12
+ title: MyString
13
+ description: MyText
14
+ delivery_set: weekly
15
+ recipients: gg@ggg.com
@@ -0,0 +1,32 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ class Mg::ConvertTest < ActiveSupport::TestCase
4
+ include MetricTracking::Controller
5
+
6
+ test "should tests" do
7
+ @mg_strategy = 'e-greedy'
8
+
9
+ assert_difference 'Mg::Convert.count' do
10
+ assert_difference 'Mg::Rally.count' do
11
+ assert_difference 'Mg::CsMeta.count' do
12
+ assert_difference 'Mg::ConvertMetaType.count' do
13
+ rw(:hiz, 0, :geoff => "hayes")
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ conv = Mg::Convert.by_type(:hiz)
20
+ assert_not_nil conv
21
+
22
+ assert_equal "hayes", conv.rallies_for_meta(:geoff).first.first[0]
23
+
24
+ #short-hand method
25
+ assert_difference 'Mg::Rally.count' do
26
+ assert_difference 'Mg::CsMeta.count' do
27
+ rw(:hiz, :geoff => "hayes")
28
+ end
29
+ end
30
+
31
+ end
32
+ end