Skip to content

Commit

Permalink
Lmao
Browse files Browse the repository at this point in the history
  • Loading branch information
ericyche committed Sep 7, 2023
1 parent 5db3944 commit 242137f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ repos:
"-rn" # only display messages
]
verbose: true # always display output
exclude: .
# dependencies
- repo: https://github.com/python-poetry/poetry
rev: 1.5.0
Expand Down
35 changes: 19 additions & 16 deletions csm_web/scheduler/views/matcher.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,34 @@
import datetime

from django.db import transaction
from django.db.models import Q
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.exceptions import PermissionDenied
from rest_framework.response import Response
from rest_framework import status

from django.db.models import Q
from django.db import transaction

from scheduler.models import (
User,
Course,
Section,
Mentor,
Matcher,
MatcherPreference,
MatcherSlot,
Mentor,
Section,
Spacetime,
User,
)
from scheduler.serializers import (
MatcherPreferenceSerializer,
MatcherSlotSerializer,
MentorSerializer,
)
from .utils import get_object_or_error, logger

from scheduler.utils.match_solver import (
get_matches,
MentorTuple,
SlotTuple,
PreferenceTuple,
SlotTuple,
get_matches,
)

from .utils import get_object_or_error, logger

DEFAULT_CAPACITY = 5
TIME_FORMAT = "%H:%M" # Assuming 24-hour format in hh:mm
Expand Down Expand Up @@ -147,7 +144,9 @@ def slots(request, pk=None):
if min_mentors > max_mentors:
return Response(
{
"error": "min mentors is greater than max mentors for some slot"
"error": (
"min mentors is greater than max mentors for some slot"
)
},
status=status.HTTP_400_BAD_REQUEST,
)
Expand Down Expand Up @@ -200,7 +199,8 @@ def preferences(request, pk=None):
# get all mentor preferences
if not (is_coordinator or is_mentor):
raise PermissionDenied(
"You must be a coordinator or mentor for the course to submit this form."
"You must be a coordinator or mentor for the course to submit this"
" form."
)

if matcher is None:
Expand Down Expand Up @@ -396,7 +396,10 @@ def configure(request, pk=None):
if curslot.min_mentors > curslot.max_mentors:
return Response(
{
"error": "min mentors is greater than max mentors for some slot"
"error": (
"min mentors is greater than max mentors for some"
" slot"
)
},
status=status.HTTP_400_BAD_REQUEST,
)
Expand Down Expand Up @@ -595,7 +598,7 @@ def create(request, pk=None):
local_data = sorted(local_data, key=lambda x: x["mentor"])
server_data = sorted(server_data, key=lambda x: x["mentor"])

for (local, server) in zip(local_data, server_data):
for local, server in zip(local_data, server_data):
for key in local:
if local[key] != server[key]:
data_matches = False
Expand Down

0 comments on commit 242137f

Please sign in to comment.