FusionGEN icon indicating copy to clipboard operation
FusionGEN copied to clipboard

Failed service queries still deduct currency.

Open AnchyDev opened this issue 2 years ago • 10 comments

When creating a service query on the store, if your query fails for whatever reason (no rows affected for example) your currency is still deducted.

It would be nice if query was verified first to see if it affected any rows or failed before deducting the currency and checking out. You can replicate this issue by:

  • Create a new store item with the Query item type.
  • Write a query that you know will not affect any rows and save.
  • Use the store and observe it still takes your money.

AnchyDev avatar May 27 '23 00:05 AnchyDev

yea I can confirm, it only check if realm is online and if it is on it will execute the query (even if is wrong) and take your currency then it will appear: Your order has been processed.

Anyway we need also a fix for the other case when the query is correct it seems it will execute it but after you checkout the spinner remain stuck spinning without announcement with your order status (even if it has been executed already) so you have to force refresh the page.

CraftedRO avatar May 27 '23 17:05 CraftedRO

In my opinion, you don't need a check for that if you can't write or test a query properly, you shouldn't use the query option anyway

I don't see a bug here either As far as I know there is no safe way to get the affected rows

I played around a lot with "$this->db->affected_rows()" because of my modules and it often shows 0, even though the query was executed

But the whole store needs an update in my opinion

Err0r1 avatar May 27 '23 17:05 Err0r1

yea agree, but still we need a fix for the case when query is correct and spinner remain stuck without notice you the final status of the order like

CraftedRO avatar May 27 '23 17:05 CraftedRO

Can you explain it? Do you mean if the query fails?

Err0r1 avatar May 27 '23 17:05 Err0r1

https://github.com/FusionGen/FusionGEN/assets/24683355/a11b1d86-d9d3-4666-84c3-6863bad1d06b

CraftedRO avatar May 27 '23 18:05 CraftedRO

Is there an error in the log file or browser console? As far as i know, query also shows a success message

Err0r1 avatar May 27 '23 19:05 Err0r1

well I got only

ERROR - 2023-05-27 21:15:17 --> Invalid query: (nothing here)

but as you can see in video is really valid

you can try too my cms query:

UPDATE account_data SET avatar=1 WHERE id={ACCOUNT};

CraftedRO avatar May 27 '23 19:05 CraftedRO

Can you try it without ";" ?

Err0r1 avatar May 27 '23 19:05 Err0r1

well ok now worked without ";" kinda strange but usually you need an end to any query :grinning:

CraftedRO avatar May 27 '23 19:05 CraftedRO

In my opinion, you don't need a check for that if you can't write or test a query properly, you shouldn't use the query option anyway

I don't see a bug here either As far as I know there is no safe way to get the affected rows

I played around a lot with "$this->db->affected_rows()" because of my modules and it often shows 0, even though the query was executed

But the whole store needs an update in my opinion

Sorry, I didn't explain the issues we are having enough I guess and maybe this should be a feature request.

We need to run a query to detect if the player should be able to use the service based on other parameters, so sometimes the query will change 0 rows because they don't meet the requirements. Maybe having another query box where we can write a select statement and if it returns no rows then the store will tell the player they are not eligible for this service?

If a similar feature exists already it would be greatly appreciated if pointed out. Thanks.

AnchyDev avatar May 27 '23 23:05 AnchyDev