Skip to content

Instantly share code, notes, and snippets.

module Sortable
def sortable(columns=nil)
@@sortable ||= columns.with_indifferent_access
end
def order_condition(column='id', direction='desc')
direction = %w[asc desc].include?(direction) ? direction : 'desc'
if sortable.keys.include?(column)
column = sortable[column]
- Для трех круизов
- Посмотреть остальные дипломы
######### 1 CHAPTER ##########
- Везде проставить ссылки
- Списки с красной строки, перенос строки тоже
- Структурная схема
- Временно вырезать инфу про проект
- Данный модуль разрабатывался по зaпросу туристической фирмы
11
- 1h investigating payment error and it's consquences
- 1h taking care of 31770 booking with no customer
- 2h issue with reports not being generated
- 4h investigating missing payment emails
12
- 1h getting rid of some cancellation fee
- 4h wrong associated cruises and directions
def archive
ReconciliationEvent.find_or_create_by(payment_id: params[:id], reconciliation_date: Time.now)
render :json =>{"msg"=>Payment.update(params[:id], is_archive: true)}
end
def archive_selected
count=0
Payment.where(id: params[:ids]).each do |x|
Passenger.find_in_batches batch_size: 1000 do |passengers|
execute <<-SQL
UPDATE passengers AS p
SET cruise_index = crs.name,
person_index = person.name
FROM passengers, enquiries e, tours t, directions d, cruises crs,
(SELECT id, name FROM (
SELECT p.id, concat(coalesce(par.first_name, c.first_name), ' ',coalesce(par.last_name, c.last_name)) AS name
FROM passengers p
LEFT JOIN partners par
def importCustomers
a = Array.new
spreadsheet = open_spreadsheet(params[:file])
header = spreadsheet.row(1)
if Settings.enquiryExpireIn.present?
@expireDate =Time.now+Settings.enquiryExpireIn.to_i.days
end
(2..spreadsheet.last_row).each do |i|
# sleep(1.0/24.0)
Payment.create({:enquiry_id=>enquiry_id,:pay_ref=>charge.id,:amount=>amount,:card_fee=>card_fee,:card_holder=>charge.source.name ,:is_refund=>false,:last_four=>charge.source.last4,:customer_id=>customer_id,:charge_by=>@currentUser,:pay_type=>payMethod,:stripe_fee =>balance.fee})
- № месяца и шрифт в таблицах
- Интервал 1.15
- Изменить названия таблиц
- формулы точки вместо умножения
- отступ у хвоста в заголовках
- структуру перенести просто в выбор PO
- Фишер в методе батина
- прогноз на другие круизы
- БД
class Forecast < ActiveRecord::Base
include ForecastGenerator
belongs_to :cruise
serialize :result, JSON
def generate(cruise = nil, length, initial_data_length)
length ||= defaults[:length_months]
initial_data_length ||= defaults[:initial_data_length]
.chart-block
h2
= "Initial data for #{@data_dates.count} months"
.chart
= line_chart @data_chart
.chart-block
h2
= "Forecast for #{@months_count} months"
.chart