This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
".opacify".on({ | |
mouseover: function(e){ | |
e.target.morph({opacity: '1'}) | |
}, | |
mouseout: function(e){ | |
e.target.morph({opacity: '0.7'}) | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def integrity | |
if time_credit? | |
errors.add(:base, I18n.t(:establishment_cost_empty, :scope => [:models, :destinations, :integrity])) unless establishment_cost? | |
elsif establishment_cost? | |
errors.add(:base, I18n.t(:time_credit_empty, :scope => [:models, :destinations, :integrity])) unless time_credit? | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def integrity | |
dependent_attributes = %w(time_credit establishment_cost) | |
nullity_proc = lambda{|attr| send(attr.to_sym).nil? || send(attr.to_sym).zero?} | |
dependent_attributes.each_index do |i| | |
if nullity_proc.call(dependent_attributes[i]) && !nullity_proc.call(dependent_attributes[i-1]) | |
errors.add(dependent_attributes[i].to_sym, I18n.t("#{dependent_attributes[i]}_empty", :scope => [:models, :destinations, :integrity])) | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
destination_number = cdr.called_number | |
prefixes_array = Array.new | |
destination_number.each_char do |char| | |
prefixes_array << (destination_number[-1] or '' ) + char | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@files = ARGV | |
@files.each_with_index do |file, index| | |
pid = fork { | |
require 'stomp' | |
client = Stomp::Client.open("", "", "localhost", 61613) | |
def send_message(server, message, queue) | |
server.send("/cdr/cdr#{queue}", message, {}) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.resolve(cdr) | |
prefixes_array = Array.new | |
cdr.called_number.each_char do |char| | |
prefixes_array << (prefixes_array[-1] or '') + char | |
end | |
prefixes_array.reverse! | |
best_match = Proc.new do |destinations, prefixes| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
monthly_reports = [] | |
date = '10-10' | |
Journal.only('_id').where(:account.in => accounts, :date => Regexp.new(date)).each do |j| | |
j.reload | |
entries = j.billing_entries.to_a | |
existing_report_for_account = monthly_reports.find_index do |account| | |
account[:journal] == j.account | |
end | |
if existing_report_for_account | |
monthly_report = monthly_reports[existing_report_for_account] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
accounts = %w( 0990000047000 0990000047001 0990000047900 ) | |
("0990000091000" .. "0990000091005").each do |c| | |
accounts << c | |
end | |
("0990000071000" .. "0990000071019").each do |c| | |
accounts << c | |
end | |
date = '10-11' | |
def reprice(accounts,date) | |
accounts.each do |acc| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module HectorFetch | |
module InstanceMethods | |
def service_with_fetch | |
res = service_without_fetch | |
logger.info("in with_fetch #{current_user}") | |
current_user.update_from_hector | |
res | |
end | |
end |
OlderNewer