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

Committing minor modifications in adjusting the functionality of lecture radio...

Committing minor modifications in adjusting the functionality of lecture radio buttons in the Lecturer Home Page
parent 1da1edbb
......@@ -215,14 +215,24 @@ class GetLectureVideoViewSetForHome(APIView):
def get(self, request):
lecturer = request.query_params.get('lecturer')
date = request.query_params.get('date')
counter = int(request.query_params.get('counter'))
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)
response = {}
# to check whether there is only one lecture video for the query
if len(serializer.data) > 1:
lecture_video_id = serializer.data[counter]['lecture_video_id']
response = serializer.data[counter]
else:
lecture_video_id = serializer.data[0]['lecture_video_id']
response = serializer.data[0]
return Response({
"response": serializer.data[0]
"response": response
})
......
......@@ -54,6 +54,10 @@
global_lecturer = $(this).attr('data-lecturer');
global_lecture_date = $(this).attr('data-date');
let counter = $(this).attr('data-counter');
alert('counter: ' + counter);
let real_date = new Date(global_lecture_date);
//extract the day
let day = '' + real_date.getDate();
......@@ -75,7 +79,7 @@
//display the video loading message
$('#student_behavior_video_loading').attr('hidden', false);
fetch('http://127.0.0.1:8000/get-lecture-video-for-home/?lecturer=' + global_lecturer + '&date=' + date_format)
fetch('http://127.0.0.1:8000/get-lecture-video-for-home/?lecturer=' + global_lecturer + '&date=' + date_format + '&counter=' + counter)
.then((res) => res.json())
.then((out) => retrieveLectureVideoDetails(out))
.catch((error) => alert('an error occurred: ' + error));
......@@ -1279,7 +1283,8 @@
name="recent_recordings_radio"
data-lecturer="{{ lecturer_detail.lecturer }}"
data-index="{{ lecturer_detail.index }}"
data-date="{{ lecturer_detail.date }}">
data-date="{{ lecturer_detail.date }}"
data-counter="{{ forloop.counter0 }}">
</label>
</div>
</td>
......
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