Habitica: API Issue: user/unlock incorrectly charges gems under numerous scenarios

Created on 22 Feb 2017  路  11Comments  路  Source: HabitRPG/habitica

General Info

  • UUID: b0413351-405f-416f-8787-947ec1c85199

Description

if the path provided is not valid (e.g. api/v3/user/unlock?path=cayennepeppersauce )the POST still returns a success, and the Items have been unlocked message.

If there is only one item listed in the command, then 2 gems are charged. If there are multiple items listed, then 5 gems are charged regardless of how many items are listed.

 {
  "success": true,
  "data": {},
  "message": "Items have been unlocked",
  "notifications": []
 }

If multiple items are mentioned in the path and they are of different values, the total of gems that is deducted is not correct. For example: api/v3/user/unlock?path=skin.candycorn,background.wedding_arch

This should cost 2 for the skin and 7 for the background (for a total of 9), but a total of 15 were deducted.

On suggestion: I think it would make more sense to setup this up more like the User - Purchase Gem or Gem-purchasable item function (/user/purchase/:type/:key)
for example, an unlock command could be: /user/unlock/background/island_waterfalls

help wanted medium Items

Most helpful comment

Hi, I'd like to work on this one!

All 11 comments

Hi, I'd like to work on this one!

@megantiu thank you! Please do! Comment here if you have questions or want to discuss approaches.

@megantiu Are you still working on this?

@MathWhiz Ah man, I'm sorry, I've been meaning to give an update on this. Other than some messing around in my dev environment, I wasn't able to produce a full-fledged solution before my life got super busy. I no longer have time to give this issue the love it deserves 馃槥

Please feel free to re-assign. I'm sorry for any inconvenience I've caused.

labels updated

@megantiu No worries at all! We understand about real-life taking precedence! Thanks for letting us know. :)

Any recent reports of this?

Yes, it's still happening.

Can you post the reports here when they come in next? @SabreCat could you do the same, please.

Just as a note, this is going to keep happening until the code is changed, even if players aren't reporting it. It's a difficult bug to find (only occurs when using the API directly) and due to the nature of the bug, some players who find it will not report it.

@paglias Have your recent changes to unlock route corrected for this issue?

Oh yes, this can be closed

Was this page helpful?
0 / 5 - 0 ratings