{"action":"closed","issue":{"url":"https://api.github.com/repos/DeepBot-API/client-websocket/issues/11","repository_url":"https://api.github.com/repos/DeepBot-API/client-websocket","labels_url":"https://api.github.com/repos/DeepBot-API/client-websocket/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/DeepBot-API/client-websocket/issues/11/comments","events_url":"https://api.github.com/repos/DeepBot-API/client-websocket/issues/11/events","html_url":"https://github.com/DeepBot-API/client-websocket/issues/11","id":126452839,"number":11,"title":"Behaviour request: Have del_points fail if not enough points","user":{"login":"ekimekim","id":570052,"avatar_url":"https://avatars.githubusercontent.com/u/570052?v=3","gravatar_id":"","url":"https://api.github.com/users/ekimekim","html_url":"https://github.com/ekimekim","followers_url":"https://api.github.com/users/ekimekim/followers","following_url":"https://api.github.com/users/ekimekim/following{/other_user}","gists_url":"https://api.github.com/users/ekimekim/gists{/gist_id}","starred_url":"https://api.github.com/users/ekimekim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekimekim/subscriptions","organizations_url":"https://api.github.com/users/ekimekim/orgs","repos_url":"https://api.github.com/users/ekimekim/repos","events_url":"https://api.github.com/users/ekimekim/events{/privacy}","received_events_url":"https://api.github.com/users/ekimekim/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-01-13T16:08:29Z","updated_at":"2016-06-27T10:02:27Z","closed_at":"2016-06-27T10:02:27Z","body":"Current behaviour:\r\n`api|set_points|test_user|10` user has 10 points\r\n`api|del_points|test_user|20` succeeds, user has 0 points\r\n\r\nDesired behaviour:\r\n`api|set_points|test_user|10` user has 10 points\r\n`api|del_points|test_user|20` fails with \"not enough points\", user remains at 10 points\r\n\r\nThis makes del_points a practical option for \"spending\" points. Currently any attempt to use it this way is subject to a race condition, where a user could change their points value between the check and the del_points:\r\n* check the user's points value is greater than cost\r\n* user's points value changes to less than cost\r\n* del_points causes user's points to go to 0. User has been able to spend points they do not have.\r\n\r\nIf there is a valid use case for having del_points ignore errors and set the user's value to 0, we could make the behaviour change depending on a flag, eg. `allow_not_enough`"}}
{"actor":{"display_login":"ekimekim"}}