k4cg / matomat-service

Matomat as a Service (MaaS)
MIT License
5 stars 2 forks source link

Transfer does not work #40

Closed noqqe closed 5 years ago

noqqe commented 5 years ago

Hi,

while using the swagger generated api to transfer credits

client.users_user_id_credits_transfer_put(user_id=target_user['id'], credits=credits_to_transfer)`

Im getting back a successful request (status code 200) with the following answer

{'credits': 0,
 'sender': {'admin': True, 'credits': 2420, 'id': 15, 'username': 'noqqe'}}

The credits field is always 0 no matter what I PUT in the API Endpoint.

Debugging Thoughts: I could not find the point in the maas codebase where this credits/amount gets lost. I was reading all the way from user_routes to transfer handler to final matomat transfer ... I guess its somewhere hidden in the if clause section over at https://github.com/k4cg/matomat-service/blob/2c02aa36435d4efff7f136078be23463a4c40394/maas-server/matomat/matomat.go#L170-L223

noqqe commented 5 years ago

Closing this.

I sent a float() to the backend via the swagger generated client library. Casting it to int() instead helped make it work.