diff --git a/backend/aethel_db/views/sample_data.py b/backend/aethel_db/views/sample_data.py index 8ad9ce4..4cddbe8 100644 --- a/backend/aethel_db/views/sample_data.py +++ b/backend/aethel_db/views/sample_data.py @@ -22,7 +22,6 @@ class AethelSampleDataPhrase: class AethelSampleError(Enum): - INVALID_SKIP = "INVALID_SKIP" INVALID_WORD = "INVALID_WORD" NO_INPUT = "NO_INPUT" @@ -39,14 +38,10 @@ def serialize(self): return asdict(self) -SAMPLE_LIMIT = 10 - - @dataclass class AethelSampleDataResponse: results: list[AethelSampleDataResult] = field(default_factory=list) error: AethelSampleError | None = None - skip: int = 0 def get_or_create_result(self, sample: Sample) -> AethelSampleDataResult: """ @@ -66,15 +61,10 @@ def get_or_create_result(self, sample: Sample) -> AethelSampleDataResult: return new_result def json_response(self) -> JsonResponse: - total_count = len(self.results) - limit = min(SAMPLE_LIMIT, total_count) - skip = max(0, self.skip) - paginated = list(self.results)[skip : skip + limit] - serialized = [result.serialize() for result in paginated] + serialized = [result.serialize() for result in self.results] return JsonResponse( { "results": serialized, - "totalCount": total_count, "error": self.error, }, status=status.HTTP_200_OK, @@ -85,18 +75,15 @@ class AethelSampleDataView(APIView): def get(self, request: HttpRequest) -> JsonResponse: type_input = self.request.query_params.get("type", None) word_input = self.request.query_params.get("word", None) - skip = self.request.query_params.get("skip", 0) response_object = AethelSampleDataResponse() - error = self.validate_input(type_input, word_input, skip) + error = self.validate_input(type_input, word_input) if error: response_object.error = error return response_object.json_response() - response_object.skip = int(skip) - word_input = json.loads(word_input) try: @@ -134,13 +121,7 @@ def validate_input( self, type_input: str | None, word_input: str | None, - skip: str | int, ) -> AethelSampleError | None: - try: - skip = int(skip) - except ValueError: - return AethelSampleError.INVALID_SKIP - try: word_input = json.loads(word_input) except json.JSONDecodeError: diff --git a/frontend/src/app/aethel/sample-details/sample-data.component.html b/frontend/src/app/aethel/sample-details/sample-data.component.html index 3514cdf..524dad1 100644 --- a/frontend/src/app/aethel/sample-details/sample-data.component.html +++ b/frontend/src/app/aethel/sample-details/sample-data.component.html @@ -1,6 +1,6 @@