Skip to content

Instantly share code, notes, and snippets.

@f-laino
f-laino / overcommission.tsx
Created February 25, 2026 10:08
over commission tool slider
getMonthlyRateLogic = commissionDelta =>
this.getValueToAddToTotalPrice(commissionDelta) / this.getDurationValueForStepCalculation()
getValueToAddToTotalPrice = commissionDelta => commissionDelta / this.props.offerFees.agentFee * 100
getValueToAddToMonthlyRate = commissionDelta => this.getMonthlyRateLogic(commissionDelta)
getSliderSteps = () => {
const { defaultValue, duration, selectedFees, monthlyRate } = this.props;
@f-laino
f-laino / attach_all_offer_to_all_agent.sh
Created November 9, 2024 09:04
Dispatch da terminale per riassociare tutte le offerte agli agenti (non include quelle custom)
# GENERALI:
# php artisan tinker
App\Offer::where('status_secondary', 'last_import')->whereNull('parent_id')->where('is_custom', false)->leftJoin('agent_offer', function ($join) {$join->on('offers.id', '=', 'agent_offer.offer_id');})->whereNull('agent_offer.offer_id')->get()->each(function ($item, $key) { App\Jobs\AttachOfferToAgents::dispatch($item); });
# IDEAL:
# php artisan tinker
App\Offer::whereNull('parent_id')->where('is_custom', false)->leftJoin('agent_offer', function ($join) {$join->on('offers.id', '=', 'agent_offer.offer_id');})->whereNull('agent_offer.offer_id')->get()->each(function ($item, $key) { App\Jobs\AttachOfferToAgents::dispatch($item); });
@f-laino
f-laino / log2s3.sh
Created October 23, 2023 10:28
Send file to Leadster S3
#!/bin/bash
CURRENT_DIR=${PWD##*/}
file_key="infrastructure/logs/$CURRENT_DIR/$1"
if [ ! -f "$1" ]
then
echo "Il file $1 non esiste in ${PWD}"
exit 1
fi