class Toolhound::Job

Class to parse GitHub repository owner and name from URLs and to generate URLs

Public Instance Methods

all(options = {}) click to toggle source
# File lib/toolhound-ruby/job.rb, line 34
def all(options = {})
  entity_id = options[:entity_id]

  wheres  = default_wheres
  selects = default_selects
  joins   = default_joins

  joins << "
    INNER JOIN (
      SELECT DISTINCT intJobID FROM tblRentalCharge WHERE tblRentalCharge.intEntityID = '#{entity_id}' AND tblRentalCharge.intJobID is NOT NULL
    ) AS tblAssignees ON tblAssignees.intJobID = tblJob.intJobID" if entity_id


  build_and_query(
    joins: joins,
    selects: selects,
    where: wheres
  )

  # joins << "INNER JOIN tblRentalCharge ON tblRentalCharge.intEntityID = '#{entity_id}' AND tblRentalCharge.intJobID is NOT NULL" if entity_id
  # SELECT DISTINCT intJobID FROM tblRentalCharge WHERE tblRentalCharge.intEntityID = '100044' AND tblRentalCharge.intJobID is NOT NULL;

end
default_joins() click to toggle source
# File lib/toolhound-ruby/job.rb, line 19
def default_joins
  arr = []
  arr << "INNER JOIN tblJobText ON (tblJobText.intJobID = tblJob.intJobID AND varLocaleID = '#{locale}')"
  # arr << "INNER JOIN tblRentalDetail ON (tblRentalDetail.intRentalDetailID = tblRentalItem.intRentalDetailID)"

  arr
end
default_selects() click to toggle source

self.table_name = :rental self.primary_key = :int_rental_id

# File lib/toolhound-ruby/job.rb, line 12
def default_selects
  {
    job:      [:int_job_id, :bol_active, :dte_created_date, :dte_modified_date],
    job_text: [:int_job_text_id, :var_job_number, :var_job]
  }
end
default_wheres() click to toggle source
# File lib/toolhound-ruby/job.rb, line 27
def default_wheres
  [
    {"job.bol_active" => true}
  ]
end
insert(variables = {}) click to toggle source
# File lib/toolhound-ruby/job.rb, line 58
def insert(variables = {})
  vars = {created_user_id: 1, modified_user_id: 1, active: true, job: nil, created_date: nil, modified_date: nil}
  # procedure("Job_Insert", vars)
end
remove(job_id) click to toggle source
# File lib/toolhound-ruby/job.rb, line 63
def remove(job_id)
  # procedure("Job_Delete", {job_id: job_id})
end