| Slightly more functional rails4 code - warvox - VoIP based wardialing tool, for… | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit 24fce918407bce8c43734e120a1f4aa4e1343656 | |
| parent 9daf341c542e2c723c6db741e469251e30768597 | |
| Author: HD Moore <[email protected]> | |
| Date: Sat, 25 Oct 2014 12:18:33 -0500 | |
| Slightly more functional rails4 code | |
| Diffstat: | |
| M app/controllers/analyze_controller… | 2 +- | |
| M app/models/job.rb | 6 +++--- | |
| M app/views/jobs/new_analyze.html.erb | 2 +- | |
| M lib/warvox/jobs/analysis.rb | 4 ++-- | |
| 4 files changed, 7 insertions(+), 7 deletions(-) | |
| --- | |
| diff --git a/app/controllers/analyze_controller.rb b/app/controllers/analyze_co… | |
| @@ -81,7 +81,7 @@ class AnalyzeController < ApplicationController | |
| def index | |
| @shown = params[:show] | |
| - ltypes = Line.find( :all, :select => 'DISTINCT line_type', :conditions… | |
| + ltypes = Line.select('DISTINCT line_type', :conditions => ["project_id… | |
| res_types = {} | |
| ltypes.each do |k| | |
| diff --git a/app/models/job.rb b/app/models/job.rb | |
| @@ -82,14 +82,14 @@ class Job < ActiveRecord::Base | |
| validates_with JobValidator | |
| def stop | |
| - self.class.update_all({ :status => 'cancelled'}, { :id => self… | |
| + self.class.where(id: self.id).update_all(status: 'cancelled') | |
| end | |
| def update_progress(pct) | |
| if pct >= 100 | |
| - self.class.update_all({ :progress => pct, :completed_a… | |
| + self.class.where(id: self.id).update_all(:progress => pct, :completed_at… | |
| else | |
| - self.class.update_all({ :progress => pct }, { :id => s… | |
| + self.class.where(id: self.id).update_all(:progress => … | |
| end | |
| end | |
| diff --git a/app/views/jobs/new_analyze.html.erb b/app/views/jobs/new_analyze.h… | |
| @@ -1,6 +1,6 @@ | |
| <h1 class='title'>Call Analysis</h1> | |
| -<%= semantic_form_for(@job, :url => analyze_project_job_path(@project) ) do |f… | |
| +<%= semantic_form_for(@job, :url => analyzer_job_path, :html => { :multipart =… | |
| <% if @project %> | |
| <%= f.input :project_id, :as => :hidden, :input_html => { :value => @p… | |
| diff --git a/lib/warvox/jobs/analysis.rb b/lib/warvox/jobs/analysis.rb | |
| @@ -148,10 +148,10 @@ class Analysis < Base | |
| def run_analyze_call(cid, jid) | |
| - dr = Call.find(cid, :include => :job) | |
| + dr = Call.includes(:job).where(id: cid).first | |
| dr.analysis_started_at = Time.now | |
| dr.analysis_job_id = jid | |
| - dr.save | |
| + dr.save! | |
| WarVOX::Log.debug("Worker processing audio for #{dr.number}...… | |