Added operating system translations...
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 15 Jul 2013 00:54:11 +0100
changeset 128 b0083f806b57
parent 127 bc031644d89e
child 132 19ff45270721
child 133 bef72dea1e7e
child 134 287e1365b137
Added operating system translations... ..to unify OS identification strings in the user interface.
web/Rakefile
web/app/models/benchmark_configuration.rb
web/app/models/operating_system.rb
web/app/views/index/_benchmarks_table.html.erb
web/app/views/results/_results_nav.html.erb
web/app/views/results/configuration_results.html.erb
--- a/web/Rakefile	Mon Jul 15 00:45:51 2013 +0100
+++ b/web/Rakefile	Mon Jul 15 00:54:11 2013 +0100
@@ -4,3 +4,9 @@
 require File.expand_path('../config/application', __FILE__)
 
 CalipelWeb::Application.load_tasks
+
+
+desc "Fetches production databse"
+task :'db:seed:production' do  
+  `scp  "swing.fit.cvut.cz:/home/hlopkmar/calipel/current/db/production.sqlite3" "db/development.sqlite3"`
+end
--- a/web/app/models/benchmark_configuration.rb	Mon Jul 15 00:45:51 2013 +0100
+++ b/web/app/models/benchmark_configuration.rb	Mon Jul 15 00:54:11 2013 +0100
@@ -11,6 +11,10 @@
 #  updated_at          :datetime
 #
 
+
+
+  
+
 class BenchmarkConfiguration < ActiveRecord::Base
 
   has_many :benchmark_batches, dependent: :destroy, inverse_of: :benchmark_configuration
@@ -19,7 +23,8 @@
   belongs_to :operating_system, inverse_of: :benchmark_configurations
 
   def name
-    "#{runtime.name} (#{language.name}) on #{operating_system.name}"
+    xlated_os = operating_system.name_normalized
+    "#{runtime.name} (#{language.name}) on #{xlated_os}"
   end
 
   def all_benchmark_infos
--- a/web/app/models/operating_system.rb	Mon Jul 15 00:45:51 2013 +0100
+++ b/web/app/models/operating_system.rb	Mon Jul 15 00:54:11 2013 +0100
@@ -8,8 +8,29 @@
 #  updated_at :datetime
 #
 
+OPERATING_SYSTEM_NAME_XLATIONS = 
+  {
+    /xp 5.1 i586/ => 'Windows XP (i386)',
+    /Linux 3\..*i686/ => 'Linux 3.x (i386)',
+
+    /5.1 IX86/ => 'Windows XP (i386)',
+    /linux-gnu i686/ => 'Linux x.x (i386)'
+  }
+
+
 class OperatingSystem < ActiveRecord::Base
 
   has_many :benchmark_configurations, inverse_of: :operating_system
 
+
+  # Return normalized OS name - suitable for UI
+  def name_normalized
+    nm = self.name    
+    OPERATING_SYSTEM_NAME_XLATIONS.each_key do | matcher |
+      if matcher.match(nm)
+        return OPERATING_SYSTEM_NAME_XLATIONS[matcher]
+      end
+    end
+    return nm
+  end 
 end
--- a/web/app/views/index/_benchmarks_table.html.erb	Mon Jul 15 00:45:51 2013 +0100
+++ b/web/app/views/index/_benchmarks_table.html.erb	Mon Jul 15 00:54:11 2013 +0100
@@ -4,18 +4,19 @@
       <tr>
         <th>Benchmark</th>
 
-        <th>Max [ms]</th>
-        <th>Avg [ms]</th>
         <th>Min [ms]</th>
+        <th style="color: gray;">Avg [ms]</th>
+        <th style="color: gray;">Max [ms]</th>
       </tr>
     </thead>
     <tbody>
       <% results.benchmark_results.each do |result| %> 
         <tr>
           <th><%= result.benchmark_info.name %></th>
-          <td><%= result.max_duration %></td>
-          <td><%= result.average_duration %></td>
           <td><%= result.min_duration %></td>
+          <td style="color: gray;"><%= result.average_duration %></td>
+          <td style="color: gray;"><%= result.max_duration %></td>
+                    
         </tr>
       <% end %>
     </tbody>
--- a/web/app/views/results/_results_nav.html.erb	Mon Jul 15 00:45:51 2013 +0100
+++ b/web/app/views/results/_results_nav.html.erb	Mon Jul 15 00:54:11 2013 +0100
@@ -12,7 +12,7 @@
                   <%= nav_tab(benchmark_configuration.id, 
                               current_tab: current_tab, 
                               class: "special") do
-                                link_to(benchmark_configuration.operating_system.name, 
+                                link_to(benchmark_configuration.operating_system.name_normalized, 
                                         configuration_results_path(id: benchmark_configuration.id)) 
                               end %>
                 <% end %>
--- a/web/app/views/results/configuration_results.html.erb	Mon Jul 15 00:45:51 2013 +0100
+++ b/web/app/views/results/configuration_results.html.erb	Mon Jul 15 00:54:11 2013 +0100
@@ -1,13 +1,13 @@
 <%= currently_viewing_results_of @benchmark_configuration.name %>
 
 <h1><%= @benchmark_configuration.language.name %></h1>
-<h2><%= @benchmark_configuration.name %></h2>
+<h2><%= @benchmark_configuration.runtime.name %>, <%= @benchmark_configuration.operating_system.name_normalized %></h2>
 
 <div id="results-accordion" class="accordion">
 
   <%= render 'index/timeline_table', benchmark_configuration: @benchmark_configuration %>
 
-  <% @benchmark_configuration.benchmark_batches.each do |result| %> 
+  <% @benchmark_configuration.benchmark_batches.reverse.each do |result| %> 
 
     <div class="accordion-group">
       <div class="accordion-heading">