Commit 1da1edbb authored by I.K Seneviratne's avatar I.K Seneviratne

Committing minor modifications in the Lecturer Home Page

parent a03e6d94
......@@ -198,7 +198,7 @@ class GetLectureVideoViewSet(APIView):
lecturer_video = LectureVideo.objects.filter(lecturer_id=lecturer, date=date)
serializer = LectureVideoSerializer(lecturer_video, many=True)
lecture_video_id = serializer.data[index]['lecture_video_id']
lecture_video_id = serializer.data[0]['lecture_video_id']
print('lecture video id: ', lecture_video_id)
activities = LectureActivity.objects.filter(lecture_video_id__lecture_video_id=lecture_video_id)
isActivityFound = (len(activities) > 0)
......@@ -209,6 +209,24 @@ class GetLectureVideoViewSet(APIView):
})
# this API will retrieve lecture video details for lecturer Home Page
class GetLectureVideoViewSetForHome(APIView):
def get(self, request):
lecturer = request.query_params.get('lecturer')
date = request.query_params.get('date')
lecturer_video = LectureVideo.objects.filter(lecturer_id=lecturer, date=date)
serializer = LectureVideoSerializer(lecturer_video, many=True)
lecture_video_id = serializer.data[0]['lecture_video_id']
print('lecture video id: ', lecture_video_id)
return Response({
"response": serializer.data[0]
})
# ACTIVITY
# API for lecture activities
class LectureActivityViewSet(APIView):
......
......@@ -75,7 +75,7 @@
//display the video loading message
$('#student_behavior_video_loading').attr('hidden', false);
fetch('http://127.0.0.1:8000/get-lecture-video/?lecturer=' + global_lecturer + '&date=' + date_format + '&index=' + global_lecturer_subject_index)
fetch('http://127.0.0.1:8000/get-lecture-video-for-home/?lecturer=' + global_lecturer + '&date=' + date_format)
.then((res) => res.json())
.then((out) => retrieveLectureVideoDetails(out))
.catch((error) => alert('an error occurred: ' + error));
......
......@@ -86,6 +86,9 @@ urlpatterns = [
# lecture video API (to retrieve a lecture)
url(r'^get-lecture-video/$', api.GetLectureVideoViewSet.as_view()),
# lecture video API (to retrieve a lecture)
url(r'^get-lecture-video-for-home/$', api.GetLectureVideoViewSetForHome.as_view()),
##### ACTIVITIES API #####
# lecture activity API (to retrieve lecture activities)
......@@ -150,6 +153,7 @@ urlpatterns = [
# lecture video individual student process pose estimation API (for Pose estimation)
url(r'^process-lecture-video-individual-pose-estimation', api.ProcessIndividualStudentPoseEstimation.as_view()),
##### GAZE Section #####
# lecture video Gaze estimation
url(r'^get-lecture-video-gaze-estimation-availability/$', api.GetLectureGazeEstimationAvailaibility.as_view()),
......
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