Skip to content

Instantly share code, notes, and snippets.

View beck03076's full-sized avatar

senthil kumar muthamizhan beck03076

View GitHub Profile
================= Request - 1 =====================
6 products cannot change categories
------------------------------------
I, [2015-08-14T17:09:35.568194 #17185] INFO -- : {"productIds":[131302,131384,131385,131388,131390,131392],"categoryId":642}
I, [2015-08-14T17:09:35.568228 #17185] INFO -- : ------------ Request -----------------------------------------
I, [2015-08-14T17:09:35.758727 #17185] INFO -- : ------------ Response -----------------------------------------
I, [2015-08-14T17:09:35.758792 #17185] INFO -- : {"response"=>{"code"=>200, "message"=>"SuccessBULK_UPDATE_PRODUCT_ERROR: could not execute statement; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statement\nBULK_UPDATE_PRODUCT_ERROR: could not execute statement; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statement\nBULK_UPDATE_PRODUCT_ERROR: could not execute statement; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statemen
irb(main):039:0> ["/g/p/gp065sp.jpg",
irb(main):040:1* "/g/p/gp65aq.jpg",
irb(main):041:1* "/g/p/gp065pr.jpg",
irb(main):042:1* "/G/E/GE001AM_3.jpg",
irb(main):043:1* "/G/E/GE001AQ_3.jpg",
irb(main):044:1* "/G/E/GE001CR_3.jpg",
irb(main):045:1* "/G/E/GE001EM_3.jpg",
irb(main):046:1* "/G/E/GE001GR_3.jpg",
irb(main):047:1* "/G/E/GE001OP_3.jpg",
irb(main):048:1* "/G/E/GE001PR_3.jpg",
def check_image(url)
uri = URI(url)
request = Net::HTTP.new uri.host
response= request.request_head uri.path
return response.code.to_i == 200
end
@count = 0
Image.all.each do |i|
str = i.original
def migrator(str,w,h)
if str.include?('dpjnlniaq')
@count += 1
puts "==========="
puts str
response = Cloudinary::Uploader.upload(str, :use_filename => true, :unique_filename => false, width: w, height: h)
puts response
puts "==========="
else
puts "not senthils cloud"
======= Emails =========
Enquiry, Registration, Partner, People has_and_belongs_to_many: emails
Email has_and_belongs_to_many: enquiries,registrations, partners, people
======= Others - Has Many =========
Enquiry, Registration, Partner, People has_many: tasks, as: :taskable
Enquiry, Registration, Partner, People has_many: follow_ups, as: :follow_upable
Enquiry, Registration, Partner, People has_many: notes, as: noteable
======= Others - Belongs To ==========
-- -- -- Data Migration For Organizor -- -- --
-- What is it?
-- List of SQL queries to migrate data from old database to the newly designed database.
-- It has been classified into two levels
-- 1. Level 1 (which will be in top of database hierarchy)
-- 2. Level 2 (which will be depend on the Level 1 tables)
-- Prerequisites for data migration
-- Login into MySQL prompt
class RegistrationReport
def initialize(id)
@id = id
end
def application_details
Registration.find(@id).programmes.map {|i|
[i.course_level_name,i.partner_name, i.partner_type].join("-")
}.join(",\n")
def evaluate_email_template email_template
expected_to_be_column = []
model_column_names = []
subject = email_template.subject.scan(/__.*?__/).map{|i| i.gsub(/__/,"").strip.downcase.tr(" ","_") }
body = email_template.body.scan(/__.*?__/).map{|i| i.gsub(/__/,"").strip.downcase.tr(" ","_") }
signature = email_template.signature.scan(/__.*?__/).map{|i| i.gsub(/__/,"").strip.downcase.tr(" ","_") }
expected_to_be_column << subject if subject.present?
expected_to_be_column << body if body.present?
expected_to_be_column << signature if signature.present?
expected_to_be_column = expected_to_be_column.flatten.uniq
module Evaluation
class << self
FIELDS = %w(subject body signature)
def evaluate_email_template email_template
model_column_names = []
hsh = set_hsh(email_template)
expected_to_be_column = get_column(hsh)
model_column_names = email_template.core_type.titleize.constantize.column_names