Skip to content

Commit

Permalink
Merge pull request #53 from Proskurina/ss630_state_machine_version
Browse files Browse the repository at this point in the history
Ss630 adding multi_team tabs (volume_check, quant)
  • Loading branch information
Proskurina authored Mar 28, 2017
2 parents 6cefa42 + 60fb502 commit 73e5d07
Show file tree
Hide file tree
Showing 64 changed files with 1,068 additions and 440 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/test/tmp/
/test/version_tmp/
/tmp/
.DS_Store

## Specific to RubyMotion:
.dat*
Expand Down
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ language: ruby
bundler_args: --without deployment
sudo: false
cache: bundler
before_install:
- "export PATH=$PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH"
- "if [ $(phantomjs --version) != '2.1.1' ]; then rm -rf $PWD/travis_phantomjs; mkdir -p $PWD/travis_phantomjs; fi"
- "if [ $(phantomjs --version) != '2.1.1' ]; then wget https://assets.membergetmember.co/software/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O $PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2; fi"
- "if [ $(phantomjs --version) != '2.1.1' ]; then tar -xvf $PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/travis_phantomjs; fi"
- "phantomjs --version"
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ gem "puma"
gem "sinatra"
gem "sinatra-activerecord"
gem "activerecord"
gem "activesupport"
gem "mysql2"
gem "rake"
gem "pry"
Expand All @@ -17,4 +18,9 @@ gem "sinatra-assetpack"
group :test do
gem "rspec"
gem "timecop"
gem "database_cleaner"
gem 'factory_girl'
gem "capybara"
gem "poltergeist"
gem 'launchy'
end
53 changes: 45 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,37 +1,63 @@
GEM
remote: https://rubygems.org/
specs:
activemodel (4.2.2)
activesupport (= 4.2.2)
activemodel (4.2.6)
activesupport (= 4.2.6)
builder (~> 3.1)
activerecord (4.2.2)
activemodel (= 4.2.2)
activesupport (= 4.2.2)
activerecord (4.2.6)
activemodel (= 4.2.6)
activesupport (= 4.2.6)
arel (~> 6.0)
activesupport (4.2.2)
activesupport (4.2.6)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.5.0)
public_suffix (~> 2.0, >= 2.0.2)
arel (6.0.0)
bootstrap-sass (3.1.1.1)
sass (~> 3.2)
builder (3.2.2)
capybara (2.12.1)
addressable
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
cliver (0.3.2)
coderay (1.1.0)
database_cleaner (1.5.3)
diff-lcs (1.2.5)
factory_girl (4.8.0)
activesupport (>= 3.0.0)
i18n (0.7.0)
jsmin (1.0.1)
json (1.8.3)
launchy (2.4.3)
addressable (~> 2.3)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.7.0)
mysql2 (0.3.16)
mysql2 (0.3.17)
nokogiri (1.7.0.1)
mini_portile2 (~> 2.1.0)
poltergeist (1.13.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
websocket-driver (>= 0.2.0)
pry (0.9.12.6)
coderay (~> 1.0)
method_source (~> 0.8)
slop (~> 3.4)
pry-nav (0.2.3)
pry (~> 0.9.10)
public_suffix (2.0.5)
puma (2.8.2)
rack (>= 1.1, < 2.0)
rack (1.6.4)
Expand Down Expand Up @@ -67,14 +93,25 @@ GEM
timecop (0.7.4)
tzinfo (1.2.2)
thread_safe (~> 0.1)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
xpath (2.0.0)
nokogiri (~> 1.3)

PLATFORMS
ruby

DEPENDENCIES
activerecord
activesupport
bootstrap-sass
capybara
database_cleaner
factory_girl
launchy
mysql2
poltergeist
pry
pry-nav
puma
Expand All @@ -86,4 +123,4 @@ DEPENDENCIES
timecop

BUNDLED WITH
1.10.5
1.14.5
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ How to start it

1) Generate the web assets:

rake assetpack:build
rake build:assets

2) Start the web server and go to http://localhost:9292

Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ namespace :build do
end
end

require './lib/tasks/update_old_assets_and_workflows'
1 change: 0 additions & 1 deletion app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class SmWorkflowLims < Sinatra::Base

get '/admin' do
presenter = AdminController.new(params).get_index

erb :'admin/index', :locals => { :presenter => presenter }
end

Expand Down
30 changes: 6 additions & 24 deletions app/controllers/assets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,32 @@
class AssetsController < Controller

validate_parameters_for :update, :assets_provided, 'No assets selected'
validate_parameters_for :update, :single_action, 'You cannot complete and report assets at the same time'

def update
(Asset::Completer.create!(assets:completed_assets,time:DateTime.now) if completed_assets?)||
(Asset::Reporter.create!( assets:reported_assets, time:DateTime.now) if reported_assets?)
Asset::Updater.create!(assets: assets_to_be_updated, action: params[:action])
end

def index
assets = Asset.in_state(state).with_identifier(params[:identifier])
Presenter::AssetPresenter::Index.new(assets,search,state)
Presenter::AssetPresenter::Index.new(assets, search, state)
end

private

def state
params[:state]||'in_progress'
State.find_by(name: params[:state])
end

def search
params[:identifier] && "identifier matches '#{params[:identifier]}'"
end

def completed_assets?
params[:complete].is_a?(Hash) && params[:complete].keys.present?
end

def reported_assets?
params[:report].is_a?(Hash) && params[:report].keys.present?
end

def assets_provided
completed_assets? || reported_assets?
end

def single_action
completed_assets? ^ reported_assets?
end

def completed_assets
@assets||=Asset.find(params[:complete].keys)
params[:assets].is_a?(Hash) && params[:assets].keys.present?
end

def reported_assets
@assets||=Asset.find(params[:report].keys)
def assets_to_be_updated
@assets||=Asset.find(params[:assets].keys)
end

end
20 changes: 11 additions & 9 deletions app/controllers/workflows_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ class WorkflowsController < Controller

def create
Workflow::Creator.create!(
:name => params[:name],
:has_comment => params[:hasComment] || false,
:reportable => params[:reportable] || false,
:turn_around_days => params[:turn_around_days]
name: params[:name],
has_comment: params[:hasComment] || false,
reportable: params[:reportable] || false,
initial_state_name: params[:initial_state_name],
turn_around_days: params[:turn_around_days]
)
end

Expand All @@ -29,11 +30,12 @@ def show

def update
Workflow::Updater.create!(
:workflow => workflow,
:name => params[:name],
:has_comment => params[:hasComment] || false,
:reportable => params[:reportable] || false,
:turn_around_days => turn_around_days
workflow: workflow,
name: params[:name],
has_comment: params[:hasComment] || false,
reportable: params[:reportable] || false,
initial_state_name: params[:initial_state_name],
turn_around_days: turn_around_days
)
end

Expand Down
2 changes: 2 additions & 0 deletions app/manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
require './app/models/asset_type'
require './app/models/batch'
require './app/models/comment'
require './app/models/event'
require './app/models/state'
require './app/models/workflow'
require './app/models/pipeline_destination'
require './app/models/cost_code'
Expand Down
Loading

0 comments on commit 73e5d07

Please sign in to comment.