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
Plan.all.each do |plan| | |
unless plan.plus_kind == "platinum" | |
puts "plan_id => #{plan.id}, :kind_was => #{plan.plus_kind}" | |
plan.update_attributes(:plus_kind => "gold") | |
end | |
end | |
plan_id => 52, :kind_was => regular | |
plan_id => 53, :kind_was => regular | |
plan_id => 54, :kind_was => regular |
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
File.open("log/change_bill_at_of_membership_recurrency.log", "w") do |file| | |
Membership.transaction do | |
location = Location.find_by_acronym("POR") | |
membership_recurrencies = MembershipRecurrency.find(location.active_memberships.map(&:membership_recurrency_id).uniq).select{ |mr| mr.bill_day != 1 } | |
membership_recurrencies.each do |membership_recurrency| | |
membership = membership_recurrency.memberships.active.first | |
file.puts "#{membership.person.id};#{membership.person.name};" | |
old_bill_day = membership_recurrency.bill_day | |
changer = BillAtChanger.new(membership, 1) |
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
# -*- encoding : utf-8 -*- | |
[Date.parse("2015-05-01"), Date.parse("2015-04-01")].each do |date| | |
Octopus.each do | |
Location.bioritmo_or_franchising.each do |location| | |
book = Spreadsheet::Workbook.new | |
sheet1 = book.create_worksheet(:name => "Geral") | |
sheet1.row(0).concat %w{CONSULTOR VENDAS META PORCENTAGEM COMISSÃO} | |
goals = location.goals.sales.find(:all, :conditions => { :date => date }) | |
location_goal = Goal.new(:location_id => location.id, :kind => :sales, :date => date) |
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
Octopus.each do | |
Location.bioritmo.each do |location| | |
plan = location.plans.where("name like '%Winter Pass%'").last | |
if plan | |
puts location.name | |
puts plan.memberships.map(&:purchase).compact.flat_map(&:payments).select{|p| p.external_transaction_code.nil? || p.external_transaction_code == "1"}.map(&:id) | |
end | |
end | |
end;nil |
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 show_attribute_diff(version, attr_name) | |
changeset = version.changeset.fetch(attr_name, "Sem Alterações") | |
if no_diff?(changeset) | |
"Sem Alterações" | |
else | |
"DE:#{default_string_when_nil(changeset[0])} PARA:#{default_string_when_nil(changeset[1])}".html_safe | |
end | |
end | |
def show_price_diff(version) |
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
File.open("taxons_report.csv", "w") do |file| | |
file.puts "SKU;NOME;CATEGORIAS" | |
Spree::Variant.all.each do |variant| | |
file.puts "#{variant.sku};#{variant.product.name};#{variant.product.taxons.map(&:name).join(';')}" | |
end | |
end;nil |
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
Spree::Product.update_all(zoom_enabled: true) |