fixes
authorMarcel Hlopko <marcel.hlopko@gmail.com>
Wed, 26 Jun 2013 00:05:56 +0200
changeset 111 28dccacb2bc1
parent 110 02126b7e1cbb
child 112 e8d75fe4e580
fixes
web/app/controllers/compare_controller.rb
web/app/controllers/results_controller.rb
web/app/helpers/compare_helper.rb
web/app/helpers/settings/runtimes_helper.rb
web/app/models/compare_query.rb
web/app/views/compare/index.html.erb
web/app/views/index/_compare_table.html.erb
web/app/views/results/_results_nav.html.erb
web/app/views/results/configuration_results.html.erb
web/app/views/results/impl_results.html.erb
web/config/routes.rb
--- a/web/app/controllers/compare_controller.rb	Tue Jun 25 23:35:43 2013 +0200
+++ b/web/app/controllers/compare_controller.rb	Wed Jun 26 00:05:56 2013 +0200
@@ -1,13 +1,13 @@
 class CompareController < ApplicationController
   def index
     @compare_query = CompareQuery.new
-    @runtimes = []
+    @benchmark_configurations = []
     @benchmark_info = nil
   end
 
   def filter
     @compare_query = CompareQuery.new(compare_query_params)
-    @runtimes = @compare_query.filtered_runtimes
+    @benchmark_configurations =  @compare_query.filtered_benchmark_configurations
     @benchmark_info = @compare_query.benchmark_info
     render "index"
   end
--- a/web/app/controllers/results_controller.rb	Tue Jun 25 23:35:43 2013 +0200
+++ b/web/app/controllers/results_controller.rb	Wed Jun 26 00:05:56 2013 +0200
@@ -2,8 +2,8 @@
   def index
   end
 
-  def runtime_results
-    @runtime = Runtime.find(params[:id])
+  def configuration_results
+    @benchmark_configuration = BenchmarkConfiguration.find(params[:id])
   end
 
 end
--- a/web/app/helpers/compare_helper.rb	Tue Jun 25 23:35:43 2013 +0200
+++ b/web/app/helpers/compare_helper.rb	Wed Jun 26 00:05:56 2013 +0200
@@ -1,12 +1,12 @@
 module CompareHelper
 
-  def comparing_runtimes_headline(runtimes)
-    if runtimes.empty?
+  def comparing_configurations_headline(benchmark_configurations)
+    if benchmark_configurations.empty?
       "Nothing to compare"
-    elsif runtimes.size == 1
-      "Showing #{runtimes.first.name}"
+    elsif benchmark_configurations.size == 1
+      "Showing #{benchmark_configurations.first.name}"
     else
-      "Comparing #{runtimes.map(&:name)[0..-2].join(", ")} and #{runtimes[-1].name}"
+      "Comparing #{benchmark_configurations.map(&:name)[0..-2].join(", ")} and #{benchmark_configurations[-1].name}"
     end
   end
 
--- a/web/app/helpers/settings/runtimes_helper.rb	Tue Jun 25 23:35:43 2013 +0200
+++ b/web/app/helpers/settings/runtimes_helper.rb	Wed Jun 26 00:05:56 2013 +0200
@@ -9,7 +9,7 @@
   end
 
   def all_dates_when_performed(runtimeOrRuntimes)
-    if runtimeOrRuntimes.kind_of?(Runtime)
+    if runtimeOrRuntimes.kind_of?(BenchmarkConfiguration)
       runtimeOrRuntimes.all_dates_when_performed
     elsif runtimeOrRuntimes.kind_of?(Enumerable) || runtimeOrRuntimes.kind_of?(ActiveRecord::Relation)
       SortedSet.new(runtimeOrRuntimes.map(&:all_dates_when_performed).flatten).to_a
--- a/web/app/models/compare_query.rb	Tue Jun 25 23:35:43 2013 +0200
+++ b/web/app/models/compare_query.rb	Wed Jun 26 00:05:56 2013 +0200
@@ -1,15 +1,15 @@
 class CompareQuery
   include ActiveModel::Model
 
-  attr_accessor :benchmark_id, :runtimes
+  attr_accessor :benchmark_id, :benchmark_configurations
 
   def initialize(*args)
     super
-    @runtimes ||= {}
+    @benchmark_configurations ||= {}
   end
 
-  def filtered_runtimes
-    Runtime.where(id: runtimes_to_array_of_ids)
+  def filtered_benchmark_configurations
+    BenchmarkConfiguration.where(id: benchmark_configurations_to_array_of_ids)
   end
 
   def benchmark_info
@@ -18,7 +18,7 @@
 
   private
 
-  def runtimes_to_array_of_ids
-    runtimes.keys
+  def benchmark_configurations_to_array_of_ids
+    benchmark_configurations.keys
   end
 end
--- a/web/app/views/compare/index.html.erb	Tue Jun 25 23:35:43 2013 +0200
+++ b/web/app/views/compare/index.html.erb	Wed Jun 26 00:05:56 2013 +0200
@@ -7,7 +7,7 @@
       builder: CalipelFormBuilder do |f| %> 
       <%= f.fieldset_item "Comparing" do %>
         <%= f.select_field_item :benchmark_id, all_benchmarks_options %>
-        <%= f.checkboxes_item :runtimes, all_runtimes_options %>
+        <%= f.checkboxes_item :benchmark_configurations, all_configurations_options %>
         <%= f.submit_item "Compare" %>
       <% end %>
     <% end %>
@@ -15,17 +15,17 @@
 </div>
 
 <div class="span9">
-  <% unless @runtimes.empty? %>
+  <% unless @benchmark_configurations.empty? %>
     <h1>
       Comparison for 
       <%= @benchmark_info.name %>
     </h1>
     <p>
-      <%= comparing_runtimes_headline(@runtimes) %>
+      <%= comparing_configurations_headline(@benchmark_configurations) %>
     </p>
 
     <%= render "index/compare_table", 
-      runtimes: @runtimes, 
+      benchmark_configurations: @benchmark_configurations, 
       benchmark_info: @benchmark_info %>
   <% end %>
 </div>
--- a/web/app/views/index/_compare_table.html.erb	Tue Jun 25 23:35:43 2013 +0200
+++ b/web/app/views/index/_compare_table.html.erb	Wed Jun 26 00:05:56 2013 +0200
@@ -5,19 +5,19 @@
       <thead>
         <tr>
           <th>Měsíc</th>
-          <% runtimes.each do |runtime| %> 
-            <th><%= runtime.name %></th>
+          <% benchmark_configurations.each do |benchmark_configuration| %> 
+            <th><%= benchmark_configuration.name %></th>
           <% end %>
         </tr>
       </thead>
       <tbody>
-        <% all_dates_when_performed(runtimes).each do |date| %>
+        <% all_dates_when_performed(benchmark_configurations).each do |date| %>
           <tr>
             <%= content_tag :th, 
               (make_chart ? date_to_millis(date) : t(date)), 
               'data-timestamp' => date_to_millis(date) %>
-            <% runtimes.each do |runtime| %>
-              <td><%= runtime.results_of(benchmark_info, date).try(:min_duration) %></td>
+            <% benchmark_configurations.each do |benchmark_configuration| %>
+              <td><%= benchmark_configuration.results_of(benchmark_info, date).try(:min_duration) %></td>
             <% end %>
           </tr>
         <% end %>
--- a/web/app/views/results/_results_nav.html.erb	Tue Jun 25 23:35:43 2013 +0200
+++ b/web/app/views/results/_results_nav.html.erb	Wed Jun 26 00:05:56 2013 +0200
@@ -5,9 +5,19 @@
         <li class="nav-header"><%= lang.name %></li>
         <ul class="nav nav-list">
           <% lang.runtimes.each do |runtime| %>
-            <%= nav_tab(runtime.name, 
-                        current_tab: current_tab, 
-                        class: "special") { link_to(runtime.name, runtime_results_path(id: runtime.id)) } %>
+            <ul class="nav nav-list">
+              <li class="nav-header"><%= runtime.name %></li>
+              <ul class="nav nav-list">
+                <% runtime.benchmark_configurations.each do |benchmark_configuration| %>
+                  <%= nav_tab(benchmark_configuration.id, 
+                              current_tab: current_tab, 
+                              class: "special") do
+                                link_to(benchmark_configuration.operating_system.name, 
+                                        configuration_results_path(id: benchmark_configuration.id)) 
+                              end %>
+                <% end %>
+              </ul>
+            </ul>
           <% end %>
         </ul>
       <% end %>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/views/results/configuration_results.html.erb	Wed Jun 26 00:05:56 2013 +0200
@@ -0,0 +1,30 @@
+<%= currently_viewing_results_of @benchmark_configuration.name %>
+
+<h1><%= @benchmark_configuration.language.name %></h1>
+<h2><%= @benchmark_configuration.name %></h2>
+
+<div id="results-accordion" class="accordion">
+
+  <%= render 'index/timeline_table', benchmark_configuration: @benchmark_configuration %>
+
+  <% @benchmark_configuration.benchmark_batches.each do |result| %> 
+
+    <div class="accordion-group">
+      <div class="accordion-heading">
+        <%= link_to l(result.performed_at),
+          "#result_#{result.id}",
+          'class' => "accordion-toggle", 
+          'data-toggle' => "collapse",
+          'data-parent' => "#results-accordion" %>
+      </div>
+      <%= content_tag :div, 
+        id: "result_#{result.id}",
+        class: "accordion-body collapse" do %>
+        <div class="accordion-inner">
+          <%= render 'index/benchmarks_table', results: result %>
+        </div>
+      <% end %>
+    </div>
+
+  <% end %>
+</div>
--- a/web/app/views/results/impl_results.html.erb	Tue Jun 25 23:35:43 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<%= currently_viewing_results_of @runtime.name %>
-
-<h1><%= @runtime.language.name %></h1>
-<h2><%= @runtime.name %></h2>
-
-<div id="results-accordion" class="accordion">
-
-  <%= render 'index/timeline_table', runtime: @runtime %>
-
-  <% @runtime.benchmark_batches.each do |result| %> 
-
-    <div class="accordion-group">
-      <div class="accordion-heading">
-        <%= link_to l(result.performed_at),
-          "#result_#{result.id}",
-          'class' => "accordion-toggle", 
-          'data-toggle' => "collapse",
-          'data-parent' => "#results-accordion" %>
-      </div>
-      <%= content_tag :div, 
-        id: "result_#{result.id}",
-        class: "accordion-body collapse" do %>
-        <div class="accordion-inner">
-          <%= render 'index/benchmarks_table', results: result %>
-        </div>
-      <% end %>
-    </div>
-
-  <% end %>
-</div>
--- a/web/config/routes.rb	Tue Jun 25 23:35:43 2013 +0200
+++ b/web/config/routes.rb	Wed Jun 26 00:05:56 2013 +0200
@@ -20,7 +20,7 @@
 
   resources :results, only: :index do
     collection do
-      get "runtime/:id", action: :runtime_results, as: 'runtime'
+      get "configuration/:id", action: :configuration_results, as: 'configuration'
     end
   end