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

Issue 75 create api view for completing a challenge #127

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

Conversation

someonebear
Copy link
Contributor

@someonebear someonebear commented Jan 22, 2025

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.

  • The pull request title has an issue number
  • The change works by "Smoke testing" or quick testing
  • The change has tests
  • The change has documentation

Other Information

: )

Related issue

Copy link

vercel bot commented Jan 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
blingo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 22, 2025 9:45am

Copy link
Member

@HuxleyBerry HuxleyBerry left a 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.

Comment on lines +294 to +295
if image and tile.consent:
tile.image = image
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

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.

Comment on lines +309 to +310
user = get_object_or_404(User, is_active=True,
user_id=tile.user.user_id)
Copy link
Member

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?

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.

Create API view for completing a challenge
3 participants