This file contains 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 product_info | |
product_name_reg = /^#{I18n.t('pages.dashboard.messages.order.new', product: '(.*)', amount: '(.*)', price: '(.*)')}$/ | |
total_reg = /^#{I18n.t('pages.dashboard.messages.order.total', total: '')}(.*)$/ | |
product_name = content.match(product_name_reg).try(:[], 1) | |
total = content.match(total_reg).try(:[], 1) | |
result = total.present? ? '%s (%s)' : '%s' | |
result % [product_name, total] | |
end |
This file contains 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
company_id = 11973147 | |
wrong_field = :active_reviews_count | |
# before | |
CoreDenormalization::Fields::Company::Reviews.value_as_string(object: company_id, field: wrong_field) | |
sql_for_data = initialize_statement # with company_id filter | |
data = ActiveRecord::Base.connection.execute sql_for_data | |
hash_with_object_key = {data.delete(:object_id) => data} | |
CoreDenormalization::Fields::Company::Reviews.instance.write_data hash_with_object_key |
This file contains 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 reload_companies_products(*ids) | |
Company.find(ids).each do |company| | |
company.products.find_each { |prod| prod.transmitter_update } | |
CompaniesSweeper.expire(company) | |
end | |
end |
This file contains 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
/* | |
* Обработка событий для YML на СК | |
* | |
*/ | |
app.modules.companyYmlAction = (function(self) { | |
var | |
$clickedButton; | |
function _getContentForPopup(options) { |
This file contains 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
# coding: utf-8 | |
class MeasureUnitCache | |
include Singleton | |
def self.find_similar_to_name(name) | |
instance.data[name] | |
end | |
private |
This file contains 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
# coding: utf-8 | |
class CreateCompanyStatisticsExpModels < Core::Migration | |
def self.up | |
with_connection Statistics::DbBase.connection do | |
Statistics::DbBase.transaction do | |
execute "CREATE SCHEMA statistics_exp" | |
create_master_table("statistics_exp.company_statistic_geo_by_months") do |t| | |
t.integer :company_id, :null => false | |
t.date :date, :null => false |
This file contains 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
date = Date.parse('2014-07-31') | |
week = CoreStatistics::Base.new.get_week_by_date(date) | |
CompanyStatisticLog.transaction do | |
CompanyStatisticPagesByMonth.process date | |
CompanyStatisticReferersByWeek.process week | |
CompanyStatisticReferersByMonth.process date | |
CompanyEventLog.clear_if_needed | |
end |
This file contains 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
/*****************************************************************/ | |
/* BIFF-stream (excel file) parsing */ | |
/* */ | |
/* This file is part of catdoc project */ | |
/* (c) David Rysdam 1998 */ | |
/* (c) Victor Wagner 1998-2003, (c) Alex Ott 2003 */ | |
/*****************************************************************/ | |
#ifdef HAVE_CONFIG_H | |
#include <config.h> | |
#endif |
This file contains 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
# coding: utf-8 | |
class RollbackStatisticsDenormTriggerToPrevState < ActiveRecord::Migration | |
def self.up | |
return if Rails.env.test? | |
queue = Denormalization::Models::Queue.find_by_name('company_statistics_total_by_month') | |
return unless queue.present? | |
queue.trigger_code = <<-SQL |
This file contains 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
как пожать: | |
- удаляем индексы | |
- делаем vacuum full всего на что хватит места свободного (из товарных скорее всего хватит только на product_properties, в остальном жмется все) | |
- делаем проход vacuum по всей базе | |
- возвращаем индексы | |
если место кончается: | |
- удаляем индексы (на search_index_products в последнюю очередь) | |
- если индексов не осталось, то все, приехали... | |
- убираем часть таблиц из репликации | |
- жмем все |
OlderNewer