-
Notifications
You must be signed in to change notification settings - Fork 0
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
Issue 75 create api view for completing a challenge #127
base: main
Are you sure you want to change the base?
Issue 75 create api view for completing a challenge #127
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! I've requested a few small changes, but other than that it all looks perfect to me.
if image and tile.consent: | ||
tile.image = image |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to check for consent here. The point of the consent field is to track whether the user gives permission for the image to be shared on Blue Crew's social media. So the image the user uploads should be stored regardless.
'full_bingo' contains a boolean, representing whether the full grid has been completed. | ||
""" | ||
active_grid = get_object_or_404(BingoGrid, is_active=True) | ||
serializer = ChallengeCompleteSerializer(request.data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you'll want to call serializer.is_valid()
. Otherwise, there isn't much point of a serializer -- you could just use request.data
everywhere you are using serializer.data
.
tile the diagonal contains, either 0 or 3, -1 if no bingo. | ||
'full_bingo' contains a boolean, representing whether the full grid has been completed. | ||
""" | ||
active_grid = get_object_or_404(BingoGrid, is_active=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big deal, but I think it would make more sense to return a 500 error here. If there no active BingoGrid, then something has gone very wrong on the server's side.
user = get_object_or_404(User, is_active=True, | ||
user_id=tile.user.user_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does request.user
work instead here?
Change Summary
Added a view to complete a challenge, and give the user any points they've gotten from completing the challenge, as well as any bingos they have achieved.
Change Form
Fill this up (NA if not available). If a certain criteria is not met, can you please give a reason.
Other Information
: )
Related issue