#Coupons: not deleting after expired

1 messages · Page 1 of 1 (latest)

loud gazelle
#

the button is on, tried running the queue, and also the cron but they seem to be there still : update (i have both auto delete coupon options now)

clearer outline of issue :

  1. auto delete expired seems to not work at all, even if expiry happens after enabling.
  2. auto delete when max uses only works ON USE or event. so i had dead coupons before enabling this, and they remained, but i used one of the others and it was deleted.
#

also created a new expired coupon, it also was not deleted (assumed logic may be somewhere else)

#

the same seems to be true for deleting after max uses.

#

I used a coupon, which made it hit its usage limit, which deleted it.

trim gulch
#

Try restarting your queue worker.

systemctl restart ctrlpanel.service

trim gulch
#

If that doesn't help, I'll check it on my instance when I wake up

loud gazelle
#

i did try this, and checked this morning and still there.

trim gulch
#

Okay, I'll test it on my panel soon

loud gazelle
#

tried triggering it somehow too and didnt see any obvious errors, but lemme know when you test, ill be at work the next many hours.

trim gulch
#

Can confirm

loud gazelle
#

My expired coupons are gone now. Must be on a weird schedule but the ones which are out of uses are still there.

trim gulch
loud gazelle
#

Cool.

loud gazelle
#

i lied lol, im tired of coupons

trim gulch
#

👀

loud gazelle
#

another edgecase.. i changed from daily to everyminute to test expiry.. but one thing that does not delete is the ones from all the failed checkouts.

these usually get deleted on use, but in the odd case something goes wrong, or if, say someone adjusted the usage limit, it should be cleaned up with the expired ones (if the setting is on)

trim gulch
loud gazelle
#

its taking its time

#

-shrug- no errors.. just sitting

trim gulch
#

Yeah, i see

#

Looks like it only works with real payments and not free one

#

Hmmm

#

Lets see

#

@loud gazelle can you try hard resetting your files to development branch. Bcz it works fine for me.

git fetch
git reset --hard origin/development

COMPOSER_ALLOW_SUPERUSER=1 composer install --optimize-autoloader

php artisan migrate

php artisan cache:clear
php artisan route:clear
php artisan view:clear
php artisan config:clear
php artisan settings:clear-cache
loud gazelle
#

sorry i was not clear. the case you showed works great. There are two which im worried about.

  1. i already have some which exist because of failures in the past
  2. if i have a coupon with 10 uses allowed,
    then 5 users use it...
    then i realize i cant give so much away for free
    then i change uses to 5
    this causes the coupons to be used up, but they never get deleted.

this is not urgent for v1.2 but i do think someone will complain later. i can work around it in my own install.

#

to me it makes sense for the cleanup that happens for expired ones to also check for ones with no more uses left too, and delete both.

trim gulch
#

I understand you. That's a fair point tbh

#

Can be implemented as scheduled daily task

loud gazelle
#

yeah, ill prob have it hourly for myself.

trim gulch
loud gazelle
#

it can, i had it running every minute earlier, but thats too much.

trim gulch
#

I mean, we're charging servers hourly. And there is a lot more servers than coupons and vouchers xD

loud gazelle
#

Yee

loud gazelle
#

if you have not done this yet its probably something i can work out! or try anyway, i assume the hardest part will be finding where its all happening/not happening

trim gulch
#

Haven't touched anything yet.

loud gazelle
#

ill try!

#

you seem to have worked a lot

trim gulch
trim gulch
#

You're working only on extending delete coupons command and changing schedule to hourly?

loud gazelle
#

yes, just finished

#

also checked on giving the same features to vouchers but it seems tougher.

trim gulch
#

I've refactored the deletion process a bit, but overall, great job!

#

Due to the fact that the deletion occurred as an SQL query, garbage remained in the table where coupon usage is recorded

loud gazelle
#

i was looking over your edits, thanks!

trim gulch
loud gazelle
#

tested good !