Skip to content

Instantly share code, notes, and snippets.

Order.where('created_at >= ? AND created_at < ?', '2021-01-01', '2022-01-01').where('payment_status = ?', 'Paid').count
Order.where('created_at >= ? AND created_at < ?', '2022-01-01', '2023-01-01').where('payment_status = ?', 'Paid').count
#all 2021 order quantity
Order.where('created_at >= ? AND created_at < ?', '2021-01-01', '2022-01-01').where('payment_status = ?', 'Paid').count
#all 2022 order quantity
Order.where('created_at >= ? AND created_at < ?', '2022-01-01', '2023-01-01').where('payment_status = ?', 'Paid').count
# The actual string of the start date and end date in the two lines below need to be adjusted to reflect the date range of the inquiries you want to update.
# This script is safe to run even on inquiries that successfully sync'd to Salesforce. Therefore, you dont need to find the exact Inquiries that didnt sync,
# you can just run this for the entire day where the problem occured.
start_date = Time.strptime('05-11-2021', '%m-%d-%Y').beginning_of_day.in_time_zone
end_date = Time.strptime('05-12-2021', '%m-%d-%Y').end_of_day.in_time_zone
errors = []
<div id="asf_flash_container" class="asf-flash-container">
</div>
<div class="asf-standard-form-precontent tve_empty_dropzone">
<div class="thrv_wrapper thrv_text_element tve_empty_dropzone" data-tag="h1"><p data-css="tve-u-05f9193c3a7012"><strong><span data-css="tve-u-182ead0226d" style="font-size: 31px; color: var(--tcb-color-6);">Interested in Art Storefronts?&nbsp;</span></strong></p><p data-css="tve-u-17f2229768e"><span data-css="tve-u-182ead0226e" style="font-size: 18px; color: rgb(0, 0, 0);"><strong class=""><strong class=""><span data-css="tve-u-182eace13bb"><strong><strong><span data-css="tve-u-182eace13bb">⚠️ Final week for FREE Website Setup!</span></strong></strong></span></strong></strong></span><span data-css="tve-u-182ead02270" style="font-size: 18px; color: rgb(71, 71, 71);"><strong class="">&nbsp;</strong>Use the form below to schedule a 10-minute intro call. We'll show you what we do, answer any questions, and give you our honest opinion on if your art/photo business would be a good fit. 👇</
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W75DFV');</script>
<!-- End Google Tag Manager -->
<!-- Recaptcha V3 -->
<script src="https://www.google.com/recaptcha/api.js?render=6LdUPEsaAAAAAKA8ItbzI31D9rcP0PlGOmQEfFgO"></script>
@client.update!(
"Lead",
id: lead_id,
FirstName: (inquiry.name.present? ? inquiry.first_name : sf_lead.FirstName),
LastName: (inquiry.name.present? ? inquiry.last_name : sf_lead.LastName),
Email: inquiry.email.delete(" "),
Phone: (inquiry.phone.present? && inquiry.phone != "n/a") ? inquiry.phone.try(:first, 15) : sf_lead.phone,
City__c: (inquiry.incoming_params["city"] if inquiry.incoming_params.present?),
State__c: (inquiry.incoming_params["state"] if inquiry.incoming_params.present?),
Country__c: (inquiry.incoming_params["country"] if inquiry.incoming_params.present?),
# The actual string of the start date and end date in the two lines below need to be adjusted to reflect the date range of the inquiries you want to update.
# This script is safe to run even on inquiries that successfully sync'd to Salesforce. Therefore, you dont need to find the exact Inquiries that didnt sync,
# you can just run this for the entire day where the problem occured.
start_date = Time.strptime('05-11-2021', '%m-%d-%Y').beginning_of_day.in_time_zone
end_date = Time.strptime('05-12-2021', '%m-%d-%Y').end_of_day.in_time_zone
errors = []
Inquiry.where('created_at >= ? AND created_at < ?', start_date, end_date).each do |i|
# The actual string of the start date and end date in the two lines below need to be adjusted to reflect the date range of the inquiries you want to update.
# This script is safe to run even on inquiries that successfully sync'd to Salesforce. Therefore, you dont need to find the exact Inquiries that didnt sync,
# you can just run this for the entire day where the problem occured.
start_date = Time.strptime('10-15-2021', '%m-%d-%Y').beginning_of_day.in_time_zone
end_date = Time.strptime('10-15-2021', '%m-%d-%Y').end_of_day.in_time_zone
errors = []
Inquiry.where('created_at >= ? AND created_at < ?', start_date, end_date).each do |i|
#### OLD
def passes_budget?
if cbt_is_photographer?
if budget_okup?
true
else
false
end
else
select
charges.id,
charges.description,
charges.captured_at,
(amount / 100) as amount,
refunded,
(charges.amount_refunded / 100) as amount_refunded,
subscriptions.plan_id,
subscriptions.created,
customers.email,
1. change has_existing_website? method on Inquiry.rb
### current method
def has_existing_website?
dynamic_fields.present? && dynamic_fields['has_website'] == 'Yes'
end
#### should be changed to: