From 5d4551e4fa53316b2c5828c404b6b0a4db55767a Mon Sep 17 00:00:00 2001 From: Aman Tahiliani Date: Fri, 12 Apr 2024 17:33:07 -0400 Subject: [PATCH] Removed extra code --- backend/api/views.py | 62 -------------------------------------------- 1 file changed, 62 deletions(-) diff --git a/backend/api/views.py b/backend/api/views.py index 07f9ce4..417bf3a 100644 --- a/backend/api/views.py +++ b/backend/api/views.py @@ -312,65 +312,3 @@ class FileFilterView(APIView): {"error": f"Something went wrong: {str(e)}"}, status=status.HTTP_500_INTERNAL_SERVER_ERROR, ) - - -# class FileFilterView(APIView): -# authentication_classes = [TokenAuthentication] -# permission_classes = [IsAuthenticated] -# def get(self, request, format=None): -# try: -# # Extract filters from the query parameters -# topic_id = request.query_params.get("topic") -# professor_id = request.query_params.get("professor") -# course_id = request.query_params.get("course") -# semester_id = request.query_params.get("semester") - -# # Check if provided filter IDs exist -# if topic_id and not Topic.objects.filter(id=topic_id).exists(): -# return Response( -# {"error": f"Topic with id {topic_id} does not exist"}, -# status=status.HTTP_400_BAD_REQUEST, -# ) -# if professor_id and not Professor.objects.filter(id=professor_id).exists(): -# return Response( -# {"error": f"Professor with id {professor_id} does not exist"}, -# status=status.HTTP_400_BAD_REQUEST, -# ) -# if course_id and not Course.objects.filter(id=course_id).exists(): -# return Response( -# {"error": f"Course with id {course_id} does not exist"}, -# status=status.HTTP_400_BAD_REQUEST, -# ) -# if semester_id and not Semester.objects.filter(id=semester_id).exists(): -# return Response( -# {"error": f"Semester with id {semester_id} does not exist"}, -# status=status.HTTP_400_BAD_REQUEST, -# ) - -# # Start with the base queryset -# queryset = File.objects.all() - -# # Apply filters if they are provided -# if topic_id: -# queryset = queryset.filter(topic__id=topic_id) -# if professor_id: -# queryset = queryset.filter(professor__id=professor_id) -# if course_id: -# queryset = queryset.filter(course__id=course_id) -# if semester_id: -# queryset = queryset.filter(semester__id=semester_id) - -# # Filter files based on active peers in the past hour -# active_peer_ids = PeerUser.objects.filter( -# last_poll__gte=timezone.now() - timedelta(hours=1) -# ).values_list("id", flat=True) - -# queryset = queryset.filter(peer_users__in=active_peer_ids).distinct() - -# serializer = FileSerializer(queryset, many=True) -# return Response(serializer.data) -# except Exception as e: -# return Response( -# {"error": f"Something went wrong: {str(e)}"}, -# status=status.HTTP_500_INTERNAL_SERVER_ERROR, -# )