Skip to content

Commit

Permalink
Updated group name.
Browse files Browse the repository at this point in the history
changed some styling

updated some docs.
  • Loading branch information
JasonLovesDoggo committed Dec 2, 2023
1 parent 53cf147 commit b9955f4
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/scavenger.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 74 additions & 18 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@ A scavenger hunt website designed to prevent any form of cheating and RNG-based
Misheel Batkhuu
### UI/UX design
Chelsea Wong


# setup

do normal django setup
then run
```bash
python manage.py init
```
2 changes: 1 addition & 1 deletion core/management/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from core import models

GROUPS_PERMISSIONS = {
'Problem Setters': {
'Location Setter': {
models.QrCode: ['add', 'change', 'delete'],
models.Hint: ['add', 'change', 'delete', 'view'],
models.LogicPuzzleHint: ['view'],
Expand Down
3 changes: 2 additions & 1 deletion core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,14 @@ def members(self):
"""Returns all members of the team, it's a related manager so to convert to queryset use .all() or filter it."""
return User.objects.filter(team=str(self.id))

@property
def is_full(self):
return self.members.count() >= settings.MAX_TEAM_SIZE

def join(self, user: User):
if user in self.members.all():
return
if self.is_full():
if self.is_full:
raise IndexError("Team is full")
user.team = self
user.save()
Expand Down
10 changes: 5 additions & 5 deletions wlmac-scavenger/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@
scope="me_meta internal",
)

MAX_TEAM_SIZE: Final[int] = 4
ALWAYS_LAST_QR_PK: Final[int] = 1
ALWAYS_FIRST_QR_PK: Final[int] = 2
HINTS_GROUP_PK: Final[int] = 1
PATH_LENGTH: Final[int] = 15
MAX_TEAM_SIZE: Final[int] = 4 # max # of people per team
ALWAYS_LAST_QR_PK: Final[int] = 1 # the pk of the last qr code (that all teams must go to last)
ALWAYS_FIRST_QR_PK: Final[int] = 2 # the pk of the first qr code (that all teams must go to first)
HINTS_GROUP_PK: Final[int] = 1 # the pk of the hints group (defined in init.py)
PATH_LENGTH: Final[int] = 15 # how many locations each team must ind

try:
with open(os.path.join(os.path.dirname(__file__), "local_settings.py")) as f:
Expand Down

0 comments on commit b9955f4

Please sign in to comment.