Code-dig-ger / Backend

This is the Backend open-source API developed to provide data to our Frontend React Website. Codedigger aims at accumulating the data of competitive programming platforms into one platform.
https://api.codedigger.tech
Apache License 2.0
13 stars 16 forks source link

Implement user_rating function of Codeforces API. #26

Closed ShivamSinghal1 closed 3 years ago

ShivamSinghal1 commented 3 years ago

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.

thieleju commented 3 years ago

Hi, can I work on this?

ShivamSinghal1 commented 3 years ago

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.

thieleju commented 3 years ago

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 😄

ShivamSinghal1 commented 3 years ago

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).

thieleju commented 3 years ago

@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

ShivamSinghal1 commented 3 years ago

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 
thieleju commented 3 years ago

Thank you for your help and patience with me 😄 Here is the pr #27