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

Invalid roll numbers registration sorted #13

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

TirthGada
Copy link

Created a function in serialisers.py which checks the format of roll no starting from [18,19,20,21,22,23] as well as length and other roll no characteristics before creating a user object
WhatsApp Image 2023-10-29 at 1 43 58 AM-2
WhatsApp Image 2023-10-29 at 1 43 58 AM

@Prater-12
Copy link
Collaborator

You seem to have pushed a branch containing commits corresponding to issues other than the one you are making this PR for. You will need to make a PR containing only the commit corresponding to the check function.

A guide on how you can achieve this can be found here: #10 (comment)

@Prater-12
Copy link
Collaborator

Regarding the function itself, you have laid a foundation to how the problem can be approached. There are however some issues:

  • While your solution seems to work for obviously invalid roll numbers, it does not work for some of the less easy to detect cases mentioned in the issue:
    • 23M9999, 20101010 (invalid roll numbers)
    • 26B1001 (roll numbers that are technically valid, but of future batches)
  • Especially for applications that will remain in use for a long time with many dynamic parts, one should avoid hard-coding and magic numbers as much as possible. Having a static list [18,19,20,21,22,23] is a bit. You can try using one latest_batch variable that you set (to 23 in this case), and generate the list based on this value.

@Prater-12 Prater-12 linked an issue Oct 28, 2023 that may be closed by this pull request
@Prater-12 Prater-12 added backend Related to the backend author-action-required The PR's author is required to resolve issues labels Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author-action-required The PR's author is required to resolve issues backend Related to the backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

accounts: Invalid roll numbers being allowed during registration
2 participants