diff --git a/backend/api/endpoints/course.py b/backend/api/endpoints/course.py index edad5f0..88c8bac 100644 --- a/backend/api/endpoints/course.py +++ b/backend/api/endpoints/course.py @@ -34,8 +34,7 @@ def get(self, request: Request) -> Response: if querystring: if department := querystring.get("department"): - courses = courses.filter( - course_department=self.sanitize(department)) + courses = courses.filter(course_department=self.sanitize(department)) if name := querystring.get("name"): courses = courses.filter(course_name=name) @@ -47,8 +46,7 @@ def get(self, request: Request) -> Response: courses = courses.filter(course_id=course_id) if course_id_contains := querystring.get("course-id-contains"): - courses = courses.filter( - course_id__contains=course_id_contains) + courses = courses.filter(course_id__contains=course_id_contains) if greater_than_code := querystring.get("higher-than"): courses = courses.filter(course_id__gt=greater_than_code) @@ -64,7 +62,6 @@ def get(self, request: Request) -> Response: def post(self, request: Request) -> Response: serializer = CourseSerializer(data=request.data) - s = 10 if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) diff --git a/backend/api/endpoints/ticket.py b/backend/api/endpoints/ticket.py index 196f2c8..60cf4b2 100644 --- a/backend/api/endpoints/ticket.py +++ b/backend/api/endpoints/ticket.py @@ -10,11 +10,7 @@ from rest_framework.response import Response from rest_framework.views import APIView -from api.models.course import Course -from api.models.issue import Issues -from api.models.professor import Professor from api.models.ticket import Ticket -from api.models.user import User from api.serializers import TicketGetSerializer, TicketSerializer # We don't need to check for duplicate class names and function names. @@ -36,8 +32,7 @@ def get(self, request: Request) -> Response: querystring = self.get_querystring(request=request) if len(querystring) > 0: if department := querystring.get("department"): - tickets = tickets.filter( - course_department=self.sanitize(department)) + tickets = tickets.filter(course_department=self.sanitize(department)) if active := querystring.get("active"): tickets = tickets.filter(is_active=active.capitalize()) @@ -69,7 +64,9 @@ def patch(self, request: Request, ticket_id: int) -> Response: try: ticket = Ticket.generic.get(id=ticket_id) except Ticket.DoesNotExist: - return Response({"error": "Ticket not found"}, status=status.HTTP_404_NOT_FOUND) + return Response( + {"error": "Ticket not found"}, status=status.HTTP_404_NOT_FOUND + ) serializer = TicketSerializer(ticket, data=request.data, partial=True) if serializer.is_valid(): diff --git a/backend/api/serializers.py b/backend/api/serializers.py index 241129f..d732aca 100644 --- a/backend/api/serializers.py +++ b/backend/api/serializers.py @@ -34,12 +34,12 @@ class Meta: class TicketSerializer(serializers.ModelSerializer): - professor = serializers.PrimaryKeyRelatedField( - queryset=Professor.generic.all()) + professor = serializers.PrimaryKeyRelatedField(queryset=Professor.generic.all()) course = serializers.PrimaryKeyRelatedField(queryset=Course.generic.all()) issue = serializers.PrimaryKeyRelatedField(queryset=Issues.generic.all()) tutor = serializers.PrimaryKeyRelatedField( - queryset=User.generic.all().filter(is_tutor=True)) + queryset=User.generic.all().filter(is_tutor=True) + ) class Meta: model = Ticket diff --git a/backend/base/urls.py b/backend/base/urls.py index 7dc7199..47fbcda 100644 --- a/backend/base/urls.py +++ b/backend/base/urls.py @@ -17,7 +17,7 @@ from django.contrib import admin from django.urls import path -from api.endpoints import course, issue, professor, section, ticket, user, authenticate +from api.endpoints import authenticate, course, issue, professor, section, ticket, user urlpatterns = [ # API Config URLS @@ -72,7 +72,6 @@ # path("api/announcements/") # path("api/announcements/") # Course URLS - path("api/courses/", view=course.APICourseList.as_view(), - name="Course List View"), + path("api/courses/", view=course.APICourseList.as_view(), name="Course List View"), # path("api/courses/", view=routing.MessageViewSet.as_view()), ] diff --git a/frontend/src/API/tickets/ticketRequests.ts b/frontend/src/API/tickets/ticketRequests.ts index 3b74b6c..757949c 100644 --- a/frontend/src/API/tickets/ticketRequests.ts +++ b/frontend/src/API/tickets/ticketRequests.ts @@ -26,5 +26,6 @@ export function updateTicket(data: any) { "X-CSRFToken": csrftoken, }, }) - .then((res) => res.data).catch((e) => (console.log(e))); + .then((res) => res.data) + .catch((e) => console.log(e)); } diff --git a/frontend/src/components/fields/CheckDropField.tsx b/frontend/src/components/fields/CheckDropField.tsx index 6f0a564..243f125 100644 --- a/frontend/src/components/fields/CheckDropField.tsx +++ b/frontend/src/components/fields/CheckDropField.tsx @@ -28,8 +28,7 @@ export default function CheckDropField({ control, name }: any) { key={field.id} className="capitalize" checked={field.value} - onCheckedChange={field.onChange - } + onCheckedChange={field.onChange} > Successful diff --git a/frontend/src/components/fields/SearchFilterField.tsx b/frontend/src/components/fields/SearchFilterField.tsx index 9f1232b..732d8a8 100644 --- a/frontend/src/components/fields/SearchFilterField.tsx +++ b/frontend/src/components/fields/SearchFilterField.tsx @@ -41,8 +41,8 @@ export default function SearchFilterField({ > {field.value ? items?.data.find( - (tutor: any) => tutor.MSOID === field.value, - )?.name + (tutor: any) => tutor.MSOID === field.value, + )?.name : "select an issue"} {field.value ? professors?.data.find( - (professor: any) => - professor.professor_id === field.value, - )?.full_name + (professor: any) => + professor.professor_id === field.value, + )?.full_name : "select a professor"} @@ -287,13 +287,13 @@ export default function TicketForm() { className={cn( "w-full md:w-[35vw] lg:w-[30vw] xl:w-[40vw] justify-between", !field.value && - "text-muted-foreground font-normal", + "text-muted-foreground font-normal", )} > {field.value ? courses?.data.find( - (course: any) => course.id === field.value, - )?.course_code + (course: any) => course.id === field.value, + )?.course_code : "select a course"} {field.value ? issues?.data.find( - (issue: any) => - issue.issue_id === field.value, - )?.problem_type + (issue: any) => + issue.issue_id === field.value, + )?.problem_type : "select an issue"}
- - + +