Introduction
Introduction Statistics Contact Development Disclaimer Help
Schema overhaul for job work - warvox - VoIP based wardialing tool, forked from…
Log
Files
Refs
README
---
commit 74be216401da43b3f2234fdcf38c2a07da7c9108
parent 8fbc16b98fa9c135884a2c644af7ffadbe6a2752
Author: HD Moore <[email protected]>
Date: Mon, 31 Dec 2012 13:04:38 -0600
Schema overhaul for job work
Diffstat:
A app/models/call.rb | 37 +++++++++++++++++++++++++++++…
A app/models/call_medium.rb | 3 +++
A app/models/job.rb | 4 ++++
A app/models/line.rb | 3 +++
A app/models/line_attribute.rb | 3 +++
M app/models/project.rb | 2 ++
A app/models/signature.rb | 4 ++++
A app/models/signature_fp.rb | 4 ++++
8 files changed, 60 insertions(+), 0 deletions(-)
---
diff --git a/app/models/call.rb b/app/models/call.rb
@@ -0,0 +1,37 @@
+class Call < ActiveRecord::Base
+ belongs_to :project
+ belongs_to :provider
+ belongs_to :job
+ has_one :call_medium, :dependent => :delete
+
+ has_many :matches, :class_name => 'Call', :finder_sql => proc {
+ 'SELECT calls.*, ' +
+ " (( icount(\'{#{fprint.map{|x| x.to_s}.join(",")}}\'::…
+ 'FROM calls ' +
+ 'WHERE icount(calls.fprint) > 0 AND ' +
+ "calls.job_id = \'#{job_id}\' AND " +
+ "calls.id != \'#{id}\' " +
+# "AND (( icount(\'{#{fprint.map{|x| x.to_s}.join(",")}}\'::int…
+ 'ORDER BY matchscore DESC'
+ }
+
+ has_many :matches_all_jobs, :class_name => 'Call', :finder_sql => proc…
+ 'SELECT calls.*, ' +
+ " (( icount(\'{#{fprint.map{|x| x.to_s}.join(",")}}\'::…
+ 'FROM calls ' +
+ 'WHERE icount(calls.fprint) > 0 AND ' +
+ "calls.id != \'#{id}\' " +
+# "AND (( icount(\'{#{fprint.map{|x| x.to_s}.join(",")}}\'::int[] & cal…
+ 'ORDER BY matchscore DESC'
+ }
+
+
+ def media
+ CallMedium.find_or_create_by_call_id(self[:id])
+ end
+
+ def media_fields
+ CallMedium.columns_hash.keys.reject{|x| x =~ /^id|_id$/}
+ end
+
+end
diff --git a/app/models/call_medium.rb b/app/models/call_medium.rb
@@ -0,0 +1,3 @@
+class CallMedium < ActiveRecord::Base
+ belongs_to :call
+end
diff --git a/app/models/job.rb b/app/models/job.rb
@@ -0,0 +1,4 @@
+class Job < ActiveRecord::Base
+ has_many :calls
+ belongs_to :project
+end
diff --git a/app/models/line.rb b/app/models/line.rb
@@ -0,0 +1,3 @@
+class Line < ActiveRecord::Base
+ has_many :line_attributes
+end
diff --git a/app/models/line_attribute.rb b/app/models/line_attribute.rb
@@ -0,0 +1,3 @@
+class LineAttribute < ActiveRecord::Base
+ belongs_to :line
+end
diff --git a/app/models/project.rb b/app/models/project.rb
@@ -2,4 +2,6 @@ class Project < ActiveRecord::Base
validates_presence_of :name
attr_accessible :name, :description, :included, :excluded
+
+ has_many :lines, :calls, :jobs
end
diff --git a/app/models/signature.rb b/app/models/signature.rb
@@ -0,0 +1,4 @@
+class Signature < ActiveRecord::Base
+ has_many :signature_fps
+
+end
diff --git a/app/models/signature_fp.rb b/app/models/signature_fp.rb
@@ -0,0 +1,4 @@
+class SignatureFp < ActiveRecord::Base
+ belongs_to :signature
+
+end
You are viewing proxied material from jay.scot. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.