Code-dig-ger/Backend

Implement user_rating function of Codeforces API.

Closed this issue ยท 7 comments

In the codedigger/codeforces/api.py, implement user_rating function which calls user.rating method of Codeforces API.

Also, add a test case in codedigger/codeforces/tests/test_api.py to test the same.

Hi, can I work on this?

Hi @thieleju,

Glad to know that you're interested to work on this.
Please let us know whats will be your approach to solve this issue.

Ok, first I'm going to get into python again, since it's been a long time I last used it.
After I forked you repository and set up everything correctly, I'm going to look into similar methods of the api.py file and try to understand the structure.
Next I'm going to look into the Codeforces API documentation you provided and start implementing the user_rating function. (Maybe after I figured out what exactly this handler parameter is ๐Ÿ˜…)
Lastly I'll take a look at the contibutions.md again to make sure my pull request is valid.

Maybe some unforseen difficulties will arise during this process, but thats the overall plan ๐Ÿ˜„

Great. That's all is required for this issue.

Any difficulties/errors/ doubt you faced, feel free to ask and discuss (here or on discord).

@ShivamSinghal1 I'm currently struggling to test my new function.
How do I actually test my function in test_api.py? ๐Ÿ˜…
Has this something to do with the swagger api?

I set everything up and it is running properly I think.
image

Yes you have setup repo correctly and for testing you need to go through django testing Documentation.

Its a simple file though, you need to write a test case for your function where you need to import your function, and get output.

To run your testcase

python manage.py test codeforces.tests.test_api 

Thank you for your help and patience with me ๐Ÿ˜„
Here is the pr #27