Commit e3c708cb authored by I.K Seneviratne's avatar I.K Seneviratne

Committing the implementations of displaying graphs on activity, emotion and gaze individual pages.

parent a7659974
...@@ -168,13 +168,17 @@ class LectureVideoViewSet(APIView): ...@@ -168,13 +168,17 @@ class LectureVideoViewSet(APIView):
# serializer = LectureVideoSerializer(data=request.data, many=True) # serializer = LectureVideoSerializer(data=request.data, many=True)
serializer = LectureVideoSerializer(data=request.data) serializer = LectureVideoSerializer(data=request.data)
# serializer.create(validated_data=request.data) # serializer.create(validated_data=request.data)
data = {}
data_ser = {}
if serializer.is_valid(raise_exception=ValueError): if serializer.is_valid(raise_exception=ValueError):
print('valid') data = serializer.create(validated_data=request.data)
serializer.create(validated_data=request.data) print('data: ', data)
# data_ser = LectureVideoSerializer(data, many=True)
return Response(serializer.data, status=status.HTTP_201_CREATED) # return Response(serializer.data, status=status.HTTP_201_CREATED)
return Response(data, status=status.HTTP_201_CREATED)
# return Response(serializer.error_messages, # return Response(serializer.error_messages,
...@@ -462,6 +466,7 @@ class GetLectureEmotionReportViewSet(APIView): ...@@ -462,6 +466,7 @@ class GetLectureEmotionReportViewSet(APIView):
lecture_emotions = LectureEmotionReport.objects.filter(lecture_video_id__lecture_video_id=lecture_video_id) lecture_emotions = LectureEmotionReport.objects.filter(lecture_video_id__lecture_video_id=lecture_video_id)
serializer = LectureEmotionSerializer(lecture_emotions, many=True) serializer = LectureEmotionSerializer(lecture_emotions, many=True)
print('data: ', serializer.data)
return Response({ return Response({
"response": serializer.data, "response": serializer.data,
......
...@@ -275,6 +275,11 @@ class LectureVideoSerializer(serializers.ModelSerializer): ...@@ -275,6 +275,11 @@ class LectureVideoSerializer(serializers.ModelSerializer):
video_length=video_length video_length=video_length
) )
# retrieve the created object
created_lecture_video = LectureVideo.objects.filter(lecture_video_id=lecture_video)
create_lecture_video_ser = LectureVideoSerializer(created_lecture_video, many=True)
create_lecture_video_ser_data = create_lecture_video_ser.data
# faculty_data = validated_data.pop('faculty') # faculty_data = validated_data.pop('faculty')
# serialized_faculty = FacultySerializer(data=faculty_data) # serialized_faculty = FacultySerializer(data=faculty_data)
# #
...@@ -294,7 +299,7 @@ class LectureVideoSerializer(serializers.ModelSerializer): ...@@ -294,7 +299,7 @@ class LectureVideoSerializer(serializers.ModelSerializer):
# #
# return lecturer # return lecturer
# #
return lecture_video return create_lecture_video_ser_data
return None return None
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment