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
<% if enquiry.status == 'Deposit' %> | |
<%= enquiry.status %> | |
<% elsif enquiry.status == 'Paid' %> | |
<%= enquiry.status %> | |
<% elsif enquiry.status == 'Refund' %> | |
Over Paid | |
<% elsif enquiry.status == 'Awaiting Payment' %> | |
Awaiting Payment | |
<% 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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import Header from './components/Artist' | |
import Artist from './components/Artist'; | |
class App extends React.Component{ | |
constructor(){ |
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
Enquiry.last.partners.order(:first_name) | |
Enquiry Load (0.5ms) SELECT "enquiries".* FROM "enquiries" ORDER BY "enquiries"."id" DESC LIMIT 1 | |
Enquiry Load (0.5ms) SELECT "enquiries".* FROM "enquiries" ORDER BY "enquiries"."id" DESC LIMIT 1 | |
Partner Load (0.7ms) SELECT "partners".* FROM "partners" WHERE "partners"."enquiry_id" = $1 ORDER BY "partners"."is_cancel" ASC, first_name = '', first_name, last_name = '', last_name, ship_type, deck, "partners"."first_name" ASC [["enquiry_id", 10261]] | |
Partner Load (0.7ms) SELECT "partners".* FROM "partners" WHERE "partners"."enquiry_id" = $1 ORDER BY "partners"."is_cancel" ASC, first_name = '', first_name, last_name = '', last_name, ship_type, deck, "partners"."first_name" ASC [["enquiry_id", 10261]] |
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 sorted_pax_list | |
ship_priority = ['Standard', 'Ensuite', 'Premier', 'Premier Plus'] | |
name_condition = "CASE WHEN first_name <> '' THEN 1 ELSE 0 END DESC" | |
deck_condition = "CASE deck WHEN 'Above Deck' THEN 1 ELSE 0 END DESC" | |
ship_condition = "CASE ship_type " | |
ship_priority.each_with_index { |ship, i| ship_condition += "WHEN '#{ship}' then #{i} "} | |
ship_condition += "END DESC" | |
partners = Partner.where(id: enquiry.partners.pluck(:id)) # Somehow ordering does not work without this | |
partners.order("#{name_condition}, #{ship_condition}, #{deck_condition}") |
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
irb(main):049:0* puts Delayed::Job.all.first.last_error | |
undefined method `first_name' for nil:NilClass | |
/app/app/models/enquiry.rb:119:in `customer_name' | |
/app/vendor/bundle/ruby/2.2.0/gems/draper-1.4.0/lib/draper/delegation.rb:10:in `customer_name' | |
/app/lib/csv_generator.rb:18:in `public_send' | |
/app/lib/csv_generator.rb:18:in `block (3 levels) in save' | |
/app/lib/csv_generator.rb:18:in `map' | |
/app/lib/csv_generator.rb:18:in `block (2 levels) in save' | |
/app/vendor/bundle/ruby/2.2.0/gems/draper-1.4.0/lib/draper/delegation.rb:10:in `each' | |
/app/vendor/bundle/ruby/2.2.0/gems/draper-1.4.0/lib/draper/delegation.rb:10:in `each' |
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
rake braintree_subscriptions:update | |
~ Проверит отмененные и оконченные подписки в брейнтри и уберет их(*cancel) у юзера. | |
~ Проверяет на случай, когда в БД нет подписки, которая создалась в Брейнтри. | |
Скидочные купоны | |
~ Создаются или через админку или rake таской для оконченных Free подписок. | |
~ Поведение рассылки по дням можно изменить в таске braintree_subscriptions:send_discount_emails | |
~ Купон создастся в базе, но его нужно активировать по ссылке( метод coupon.link ) или из админки. | |
~ Купонов может быть несколько на одного юзера, но после активации одного, остальные удаляются. | |
~ После покупки с активированным купоном, создается подписка по скидочной цене, а купон удаляется. | |
Free Plan |
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 stats( params ) | |
params = params.with_indifferent_access | |
group_by = params[:group_by] || 'week' | |
cruise_name = params['cruise_name'] | |
query = "SELECT cruises.name, | |
DATE_TRUNC('#{group_by}', tours.departure) AS #{group_by}, | |
COUNT(enquiries.id) AS count_enquiries, | |
SUM(enquiries.pax) AS count_paxes, | |
SUM(CASE WHEN enquiries.booking_status='Confirmed' THEN enquiries.pax END) AS count_confirmed_paxes | |
FROM cruises |
NewerOlder