Closed margotphoenix closed 7 years ago
Thank you for your PR!
The bulk test was not added because I already have add_bulk on setUp function.
So the problem was how the parameters passed to API ?
Yeah, I think that whenever the json needs to be passed an array—which I believe might only be participant objects (in bulk_add) and tie_breaks in the tournament object—you need to put empty brackets "[]" after the name part, then pass the values in the array in order. In the example I had, it should pass [...,("tournament[tie_breaks][]","match wins vs tied"),("tournament[tie_breaks][]","points difference"),("tournament[tie_breaks][]","points scored"),...]
.
After finally updating my fork of pychallonge to the latest most-official version, I think this change should be implemented in the official version. In
challonge/api.py
, I believe that line 157 should read:params.append(("%s[%s][]" % (prefix, k), val))
When I originally wrote this section of code in June of 2015 (see this commit), the goal of it was to allow for tiebreaker rules (and the order of tiebreaker rules) for round-robin tournaments to be set via the API. To my knowledge, the attribute
"tie_breaks"
is the only attribute in the API where the value is a list. I have tested out my version of the code, and it does allow for the setting of tiebreaker rules. I have not tested out ZEDGR's code specifically, but I did attempt a more direct method of updating the API using ZEDGR's version of line 157 and I got an error. I would suggest attempting to run the following lines of code and seeing what happens:import challonge
t = challonge.tournaments.create("Test RR", "hut5wr9w", tournament_type="round robin", ranked_by="match wins", tie_breaks=["match wins vs tied","points difference","points scored"])
My current commit also contains a
bulk_add
unit test, which ZEDGR's doesn't, but that's less important.