Skip to content

Instantly share code, notes, and snippets.

apartment = Apartment.find 3511
msg = []
apartment.reservations.where(checkout_date: (Date.new(2022,4,1)..Date.new(2022,4,31))).each do |r|
msg << "#{r.order.id} - ota_fee_franchisor #{r.ota_fee_franchisor.to_f} - ota_percentage #{r.ota_percentage.to_f} - apt guest_franchisor_fee #{apartment.guest_franchisor_fee(r.order.ota)&.to_f} - apt guest_percentage_fee #{apartment.guest_percentage_fee(r.order.ota)&.to_f}"
end
msg.each do |m|
p m
end
##
{
"release_status" => "draft", "name" => "Test Carlo con allegato verifica", "version_number" => 9, "uuid" => "9759858e-74d0-4bd7-8b46-529d12f00ad3", "structure" => {
"uuid" => "239124ec-f5d1-4d1a-bd81-1cf9a028aa6f", "typology" => "root", "resource_uuid" => nil, "meta_data" => [{
"code" => "book_code",
"value" => "BSM18V_01",
"type" => "string"
}, {
"code" => "test_category",
"value" => "book",
"type" => "string"
Tutor.all.each do |tutor|
tutor.generate_tutor_search_cache
tutor.rates_count = tutor.feedbacks.positive.count - tutor.feedbacks.negative.count
tutor.opinions_count = tutor.feedbacks.with_opinion.count
tutor.save
end
/usr/local/bsmart/current/log/activations.log {
daily
missingok
rotate 7
compress
delaycompress
notifempty
copytruncate
}
{
"network_infos":{
"search_details":{
"search_id":{
"$oid":"57b5bac04d616306b9030000"
},
"search_type":"Accomodation"
},
"results":[
{
lock '3.2.1'
# Configuration
set :application, 'travel-mesh'
set :repo_url, "git@github.com:NetBookingCom/travel-mesh.git"
set :executener, fetch(:user)
set :admin_executener, fetch(:user)
set :use_sudo, false
set :normalize_asset_timestamps, false
context 'real use cases, lasted less than min duration' do
it 'elapsed seconds = 0, lesson duration = 30min, residual seconds = 45min, pay MIN' do
create(:purchased_credit, credit: bundle, student: student, residual_seconds: 45*60, expire_at: Time.now+1.year, status: :paid)
expect(lesson_service.lesson_started?).to be_falsey
expect(lesson_service.lasted_less_than_min_duration?).to be_truthy
expect(lesson_service.lasted_less_than_duration?).to be_truthy
expect(lesson_service.show_min_duration?).to be_truthy
expect(lesson_service.max_duration).to eql lesson.duration
expect(lesson_service.close_and_pay!('min')).to be_truthy
Coupon.bonus.each { |b| b.update_attributes(total_tutor_cost_cents: 750) if b.total_tutor_cost_cents == 1500 }
module ApplicationHelper
include ActionView::Helpers::AssetTagHelper
def image_tag(source, options = {})
if options[:retina]
options['data-at2x'] = path_to_image(source.split('.').join('@2x.'))
options.tap { |h| h.delete(:retina) }
else
options['data-no-retina'] = ''
end
@carloscortegagna
carloscortegagna / gist:56b32a63aad04d9b096e
Created November 19, 2014 13:52
Handlebars debug helper
Handlebars.registerHelper('debugger', function(optionalValue) {
console.log('Current Context');
console.log('====================');
console.log(this);
if (optionalValue) {
console.log('Value');
console.log('====================');
console.log(optionalValue);
}