Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Country Ranking #4

Open
recepkucek opened this issue Feb 5, 2023 · 15 comments
Open

Country Ranking #4

recepkucek opened this issue Feb 5, 2023 · 15 comments
Assignees
Labels
enhancement New feature or request

Comments

@recepkucek
Copy link

Could you please add country ranking ?

@baoliay2008
Copy link
Owner

Hi, @recepkucek If I understand correctly, is country ranking means that someone's ranking within a country?

For example, the current global ranking is like

username country ranking
Alice Austria 1
Bob Canada 2
Clare Austria 3
Dolores Austria 4
Eve Canada 5

And country ranking is something like this:

  • Austria

    username country ranking
    Alice Austria 1
    Clare Austria 2
    Dolores Austria 3
  • Canada

    username country ranking
    Bob Canada 1
    Eve Canada 2

Please correct me if I am wrong.

@recepkucek
Copy link
Author

I think, country filter for each contest might be enough.
For example, when opened contest detail page there is a search for username
so you can add another filter for country.
If country selected only users related to that country will be listed(for selected contest).
Also I think global country based ranking is needed because in the following link there is no country filter.
https://leetcode.com/contest/globalranking/
These two features would be very useful.

@baoliay2008 baoliay2008 added the enhancement New feature or request label Feb 18, 2023
@amitpant14
Copy link

Hi @baoliay2008 Can you please assign this to me if this is not taken up yet?

@amitpant14
Copy link

@baoliay2008 thanks for assigning.
@recepkucek Can you explain the second feature? I only understand one that is to add a country filter which would display a rank list only for the users of selected country. I assume it would also allow search for a particular user name under the selected country filter.

@recepkucek
Copy link
Author

@baoliay2008 thanks for assigning. @recepkucek Can you explain the second feature? I only understand one that is to add a country filter which would display a rank list only for the users of selected country. I assume it would also allow search for a particular user name under the selected country filter.

Sure. Yes you are right and this should be in separate page.
The following link shows it exactly, https://leetcode-country-ranking.onrender.com/country/GB .

To clarify
1 - In each contest page, filtering users by country and sorting by their ranking in the contest.
2 - For all contests, listing users by country and sorting by their global ranking.

So users can compare themselves with other users in a country for each contest or all contests.
If you need I can also send mock design of the features.

@baoliay2008
Copy link
Owner

Implementing the first feature should be straightforward since all the data for a specific contest is stored in the database. It should be sufficient to update the API and front-end to support the new feature.


However, I believe that adding the second feature to this APP could be challenging because for now we only have cached information, primarily the ratings and attendance counts of users in recent contests.
This limited data cannot be used to create a comprehensive global ranking. For instance:

  1. if Alice recently changed her LeetCode ID after participating in the last contest, we won't have her updated information
  2. if Bob participated in a contest a long time ago, we might not have his current information either.
  3. more additional cases that I am not currently recalling

@amitpant14
Copy link

@baoliay2008 I will try to first run the app locally. Then will think about how to implement these features. I agree that the second feature would be challenging. I think we can prepare the global ranking of users from leetcode separately if that is possible somehow. Will look into this.

@amitpant14
Copy link

@baoliay2008 What is the mongodb version used in the instance running live?

@baoliay2008
Copy link
Owner

@baoliay2008 What is the mongodb version used in the instance running live?

@amitpant14 MongoDB server version: 5.0.8

@amitpant14
Copy link

@baoliay2008 One question.
The instructions for starting the backend mention first running the main.py file and then the uvicorn. I noticed that only the main.py file handles the schedulers and not the uvicorn. Do they both run simultaneously for the live deployment? One for schedulers and another for api endpoints?

@baoliay2008
Copy link
Owner

@amitpant14 That's correct. I have implemented two distinct processes to allow for their execution on different machines, provided that they are connected to the same MongoDB database.

@amitpant14
Copy link

@baoliay2008 Do you know how does leetcode saves the country information for a user? I could not see that detail in user profile update section on leetcode. Does that means country information is not set by user and cannot be edited?

@baoliay2008
Copy link
Owner

@amitpant14 I guess updating Basic Info - Location should work?

@amitpant14
Copy link

Yeah...but like for me this field is empty, still the country is picked up correctly. That's why I am a bit unsure.
Another question, there is separate api call without pagination when username is searched, right? I am thinking of adding another field for country in the same form with username field. Noticed that complete list is fetched using another API call that has limit parameter. But for user, the call is without limit, which is fine as only one user with a specific username will be available. But if I add country field in the same form, limit parameter will need to be enabled for this call too. I was earlier thinking of using the same call as that of user/ endpoint for country too, but now I think separating them will be better.

@amitpant14
Copy link

@baoliay2008 I have completed the first feature on my local branch. Below are the screenshots for reference:
image
image
Please suggest if any changes should be made on the front-end side.
I will refactor the code and then create a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants