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

Backend with accounts and province ranking system #50

Open
wants to merge 77 commits into
base: backend+accounts+rankings
Choose a base branch
from

Conversation

AlexandreOndet
Copy link
Contributor

This PR is a new version #45, I made a new branch to showcase the new changes since the last code review, you can see them at : AlexandreOndet@db8642c

@AlexandreOndet AlexandreOndet linked an issue Sep 9, 2023 that may be closed by this pull request
Copy link
Member

@JonEsparaz JonEsparaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A partial review of the Python code with some questions and some suggestions.

Thanks, Alex.

back/backend/__init__.py Outdated Show resolved Hide resolved
back/backend/__init__.py Outdated Show resolved Hide resolved
back/backend/__init__.py Show resolved Hide resolved
back/backend/__init__.py Show resolved Hide resolved
championship.province = competition.province
championship.competition = competition.key
championship.put()
# TODO: if we changed a championship we should update champions and eligibilities.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these TODO comments aren't going to be addressed in this PR, please open an Issue and reference it in the comment here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#55

back/backend/models/region.py Outdated Show resolved Hide resolved
Comment on lines +5 to +6
# Cache mapping of province names.
provinces_by_name = {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a cache really necessary? Seems like it's possibly premature optimization and we would benefit more from making the getter simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get your point but I think we have few provinces and a lot of references to them it actually would save us a ton of request to keep the cache .If we remove it we will be querying the datastore a lot more to always get the same few results.

Comment on lines +20 to +26
maybe_province = Province.get_by_id(province_name.replace('.', '').replace(' ', '').lower())
if not maybe_province:
# Or maybe it's the name.
maybe_province = Province.query(Province.name == province_name).get()
if maybe_province:
provinces_by_name[province_name] = maybe_province
return maybe_province
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
maybe_province = Province.get_by_id(province_name.replace('.', '').replace(' ', '').lower())
if not maybe_province:
# Or maybe it's the name.
maybe_province = Province.query(Province.name == province_name).get()
if maybe_province:
provinces_by_name[province_name] = maybe_province
return maybe_province
province_by_id = Province.get_by_id(province_name.replace('.', '').replace(' ', '').lower())
if province_by_id:
return province_by_id
# Or maybe it's the name.
province_by_name = Province.query(Province.name == province_name).get()
if province_by_name:
return province_by_name
return None

back/backend/models/champion.py Outdated Show resolved Hide resolved
back/backend/models/champion.py Outdated Show resolved Hide resolved
@AlexandreOndet AlexandreOndet linked an issue Sep 10, 2023 that may be closed by this pull request
app/src/components/Api.ts Outdated Show resolved Hide resolved
back/backend/handlers/admin/show_users.py Show resolved Hide resolved
back/backend/__init__.py Show resolved Hide resolved
client = ndb.Client()


#@bp.route('/add_championship/<competition_id>/<championship_type>')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Please still make an Issue as per the other comment. (TODO comments in the code tend to get ignored more than Issues.)

back/backend/models/wca/round.py Outdated Show resolved Hide resolved
Copy link

@kr-matthews kr-matthews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the admin section, it says "1-10 of more than 10" for the pagination (there are 13 results, 10 of them visible), and then the next page says "11-20 of 20" (still 13 results of course, and 3 visible). It's just the admin page so it doesn't matter, but if there's a simple fix to "1-10 of 13" and "11-13 of 13" then that would be good.

The UI also briefly shows "No users yet" while loading, which is incorrect. Again, it's the admin page so maybe that's good enough.

Still on the admin page, improving the search to work with any part of the name would be ideal, not sure how easy that would be.

I still think the red theme is bad because all the inputs look like they're in an error state after I input something, but if nobody else has any problem with it then it's fine.

app/src/App.tsx Outdated Show resolved Hide resolved
app/src/components/MyCubingIcon.tsx Show resolved Hide resolved
app/src/components/RankList.tsx Outdated Show resolved Hide resolved
app/src/components/RankList.tsx Outdated Show resolved Hide resolved
app/src/components/Roles.ts Outdated Show resolved Hide resolved
getManyReference: (
resource: any,
params: {
//not setup

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something that needs to be done?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. I mean react-admin could maybe call it but I don't think our current use really needs to implement all the methods.

app/src/pages/Account.tsx Outdated Show resolved Hide resolved
app/src/pages/Rankings.tsx Outdated Show resolved Hide resolved
app/src/pages/Rankings.tsx Outdated Show resolved Hide resolved
app/src/pages/Rankings.tsx Show resolved Hide resolved
@kr-matthews
Copy link

More admin page stuff: if I select 5 rows per page then it just shows all 13 rows.

@AlexandreOndet
Copy link
Contributor Author

More admin page stuff: if I select 5 rows per page then it just shows all 13 rows.

I fixed it

@AlexandreOndet
Copy link
Contributor Author

AlexandreOndet commented Sep 26, 2023

To answer the comments about the user list in the admin section. Currently are limited by outside factors. For pagination and searching, I will write an issue to describe that more precisely. (edit, done: #56 )
The "no users yet" is from not React admin, not from me so it's more complicated to change. And since it loads pretty fast I couldn't even see it on my side so I guess it's okay for now.

For the red part, I understand your concern but also it's doesn't shock me at all so I would like feedback from other people to see how they feel.

This was referenced Nov 8, 2023
@AlexandreOndet AlexandreOndet changed the base branch from main to 9_future_routes November 9, 2023 23:35
@AlexandreOndet AlexandreOndet changed the base branch from 9_future_routes to backend+accounts+rankings November 9, 2023 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove web-vitals Create user account system
3 participants