Skip to content

Commit

Permalink
Added SushiApp.employee, sushi_fabric.gem ver.1.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
masaomi committed Feb 5, 2021
1 parent d39b86d commit 2155d3b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion master/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ GEM
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
sushi_fabric (1.0.5)
sushi_fabric (1.0.6)
therubyracer (0.12.3)
libv8 (~> 3.16.14.15)
ref
Expand Down
8 changes: 8 additions & 0 deletions master/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def [](x)
sushi_app_entry.required_columns = sushi_app_instance.required_columns
sushi_app_entry.next_dataset_keys = sushi_app_instance.next_dataset.keys
sushi_app_entry.description = sushi_app_instance.description
sushi_app_entry.employee = sushi_app_instance.employee
sushi_app_entry.save
rescue => err
warn err
Expand All @@ -99,6 +100,13 @@ def runnable_application(data_set_headers, refresh = true)
(app.required_columns - data_set_headers.map{|colname| colname.to_s.gsub(/\[.+\]/,'').strip}).empty?
end
end
def employee_apps
apps = {}
SushiApplication.all.select{|app| app.employee}.each do |app|
apps[app.class_name.to_s] = true
end
apps
end
def sample_path(data_set)
paths = []
data_set.samples.each do |sample|
Expand Down
1 change: 1 addition & 0 deletions master/app/controllers/data_set_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ def show
set_runnable_apps(false)
end

@employee_apps = employee_apps
@sushi_apps = @data_set.runnable_apps
@sushi_apps_category = @sushi_apps.keys.sort
else
Expand Down
4 changes: 3 additions & 1 deletion master/app/views/data_set/_sushi_application_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
<tr><td><%= category %></td>
<td style="padding: 2px;">
<% @sushi_apps[category].each do |app| %>
<%= submit_tag app.to_s, :name=>'app', :class=>"btn btn-info btn-sm raised", :style=>"padding: 2px" %>
<% if (session['employee'] and @employee_apps[app]) or !@employee_apps[app] %>
<%= submit_tag app.to_s, :name=>'app', :class=>"btn btn-info btn-sm raised", :style=>"padding: 2px" %>
<% end %>
<% end %>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddEmployeeToSushiApplication < ActiveRecord::Migration[5.2]
def change
add_column :sushi_applications, :employee, :boolean
end
end
1 change: 1 addition & 0 deletions master/lib/WordCountApp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
class WordCountApp < SushiFabric::SushiApp
def initialize
super
@employee = true
@name = 'Word_Count'
@description = "test applicaiton #{GlobalVariables::SUSHI}"
@analysis_category = 'Stats'
Expand Down

0 comments on commit 2155d3b

Please sign in to comment.