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

Create API view for completing a challenge #75

Open
HuxleyBerry opened this issue Jan 6, 2025 · 2 comments · May be fixed by #127
Open

Create API view for completing a challenge #75

HuxleyBerry opened this issue Jan 6, 2025 · 2 comments · May be fixed by #127
Assignees
Labels
backend Task must have a back end issue difficulty::hard This issue is hard priority::high This issue is high priority

Comments

@HuxleyBerry
Copy link
Member

HuxleyBerry commented Jan 6, 2025

Prerequisites

#57 and #58

Issue

This issue is for creating the view which is called when the "Finish" button is pressed:

image

The view should take the following arguments:

  • A number in the range 0-15 representing the index of the bingo tile which is being completed
  • A boolean representing whether the user has consented to bluecrew uploading the picture to social media
  • An image

The view should then do the following:

  1. Get the instance of the TileInteraction model corresponding to the combination of the logged in user, the current bingo grid, and the supplied index
  2. Update the consent and image fields of the TileInteraction instance and mark it as completed.
  3. Award the user the amount of points the challenge was worth
  4. Now comes the complicated part...calculate if any bingos (row, column or diagonal) are achieved by the completion of this challenge.
  5. For each bingo, award the user 100 points (not sure about 100, maybe make it a constant in settings.py)
  6. If the whole grid is completed, award the user 500 points (again make it a constant in settings.py)
  7. Return a message to the frontend containing:
  • The amount of points the challenge was worth
  • A list of all the rows/columns/diagonals in which a bingo was achieved (you'll have to come up with some representation)
  • Whether the whole grid just got completed
@HuxleyBerry HuxleyBerry added backend Task must have a back end issue priority::high This issue is high priority difficulty::hard This issue is hard labels Jan 6, 2025
@bibonut bibonut self-assigned this Jan 10, 2025
Copy link

@someonebear someonebear self-assigned this Jan 10, 2025
@HuxleyBerry
Copy link
Member Author

I've slightly edited the description of this issue to fit with the changes made in #87

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Task must have a back end issue difficulty::hard This issue is hard priority::high This issue is high priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants