Commit 3f1a804f authored by I.K Seneviratne's avatar I.K Seneviratne

Merge branch 'monitoring_student_behavior_IT17138000' into 'QA_RELEASE'

Monitoring student behavior it17138000

See merge request !53
parents 6af26c62 26eedac2
import requests
import json
from LectureSummarizingApp.lecture_audio_batch_process import save_lecturer_audio, summarization_batch_process
from MonitorLecturerApp.logic.lecturer_batch_process import lecturer_batch_process
from .MongoModels import LectureVideo
from . logic import batch_process as bp
from MonitorLecturerApp.logic import lecturer_batch_process as lbp
......@@ -86,8 +87,13 @@ def automation_process(lecturer, subject, subject_code, video_length="00:20:00")
"lecture_video_length": video_length
}
# create the lecturer audio
lecturer_audio_content = {}
# create the lecturer audio content
lecturer_audio_content = {
"lecturer": lecturer,
"subject": subject,
"audio_name": lecturer_audio_name
}
# save the student video
......@@ -102,7 +108,8 @@ def automation_process(lecturer, subject, subject_code, video_length="00:20:00")
print('lecturer video response: ', lecturer_video_response)
# save the lecturer audio
lecturer_audio_response = save_lecturer_audio(lecturer_audio_content)
audio_id = lecturer_audio_response['audio_id']
# for i in range(100):
# print('outer loop: ', i)
......@@ -112,24 +119,23 @@ def automation_process(lecturer, subject, subject_code, video_length="00:20:00")
# start the batch processing for lecture summarization component
# lecture_summary_batch_process = lecture_summarization_batch_process(audio_name)
lecture_summary_batch_process = True
lecture_summary_batch_process = summarization_batch_process(audio_id, lecturer_audio_name)
# if the lecture summarization process is successful
# if lecture_summary_batch_process:
#
# # start the batch processing for monitoring lecturer performance component
# lecturer_batch_process_response = lecturer_batch_process(lecturer_video_name, lecturer_audio_name)
#
# # if the lecturer performance process is successful
# if lecturer_batch_process_response:
#
# # start the batch processing for monitoring student behavior component
# student_batch_process_response = student_behavior_batch_process(student_video_id, student_video_name)
#
# # if the student behavior process is successful
# if student_batch_process_response:
# is_all_processed = True
if lecture_summary_batch_process:
# start the batch processing for monitoring lecturer performance component
lecturer_batch_process_response = lecturer_batch_process(lecturer_video_name, lecturer_audio_name)
# if the lecturer performance process is successful
if lecturer_batch_process_response:
# start the batch processing for monitoring student behavior component
student_batch_process_response = student_behavior_batch_process(student_video_id, student_video_name)
# if the student behavior process is successful
if student_batch_process_response:
is_all_processed = True
# return the status
......
......@@ -295,8 +295,6 @@
//define the lecturer video src
let lecturer_video_src = "{% static '' %}FirstApp/lecturer_videos/" + global_lecturer_video_name;
alert('hello');
//assign the video src
$('#lecturer_video').attr('src', lecturer_video_src);
......
......@@ -304,68 +304,70 @@
}
/*
//this is a test function (delete later)
//get the due lecture video name
var due_lecture_video_name = "{{ due_lecture_video_name }}";
let interval = setInterval(() => {
var isDue = {{ isDue }};
let url = 'http://127.0.0.1:8000/check-availability/?video_name=' + due_lecture_video_name;
if (isDue > 0) {
let interval = setInterval(() => {
fetch(url)
.then((res) => res.json())
.then((out) => displayProcess(out))
.catch((err) => alert('error: ' + err))
$('#activity_loader').attr('hidden', false);
}, 5000);
//get the due lecture video name
var due_lecture_video_name = "{{ due_lecture_video_name }}";
let url = 'http://127.0.0.1:8000/check-availability/?video_name=' + due_lecture_video_name;
fetch(url)
.then((res) => res.json())
.then((out) => displayProcess(out))
.catch((err) => alert('error: ' + err))
//this function will handle the displaying loaders and status in the workflow
function displayProcess(response) {
}, 5000);
//if the lecture activity has completed processing
if (response.isActivityExist) {
//this function will handle the displaying loaders and status in the workflow
function displayProcess(response) {
$('#step_1').attr("class", class1);
$('#activity_loader').hide();
$('#emotion_loader').attr('hidden', false);
//if the lecture activity has completed processing
if (response.isActivityExist) {
}
$('#step_1').attr("class", class1);
$('#activity_loader').hide();
$('#emotion_loader').attr('hidden', false);
//if the lecture emotion has completed processing
if (response.isEmotionExist) {
}
$('#step_2').attr("class", class1);
$('#emotion_loader').hide();
$('#gaze_loader').attr('hidden', false);
//if the lecture emotion has completed processing
if (response.isEmotionExist) {
}
$('#step_2').attr("class", class1);
$('#emotion_loader').hide();
$('#gaze_loader').attr('hidden', false);
//if the lecture gaze has completed processing
if (response.isGazeExist) {
}
$('#step_3').attr("class", class1);
$('#gaze_loader').hide();
}
//if the lecture gaze has completed processing
if (response.isGazeExist) {
//if all the processes are completed
if (response.isActivityExist && response.isEmotionExist && response.isGazeExist) {
$('#step_3').attr("class", class1);
$('#gaze_loader').hide();
}
var x = document.getElementById("snackbar");
x.className = "show";
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 3000);
//if all the processes are completed
if (response.isActivityExist && response.isEmotionExist && response.isGazeExist) {
//clear the setInterval function
clearInterval(interval);
}
var x = document.getElementById("snackbar");
x.className = "show";
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 3000);
//clear the setInterval function
clearInterval(interval);
}
}
*/
}
}
});
......@@ -450,11 +452,11 @@
<td class="font-weight-bolder">{{ lecture.end_time }}</td>
<td>
<span class="font-italic text-success" id="processing" hidden>Processing</span>
<button type="button" class="btn btn-success batch_process"
data-video-id="{{ lecture.video_id }}"
data-video-name="{{ lecture.video_name }}"
id="{{ lecture.subject }}">Process
</button>
{# <button type="button" class="btn btn-success batch_process"#}
{# data-video-id="{{ lecture.video_id }}"#}
{# data-video-name="{{ lecture.video_name }}"#}
{# id="{{ lecture.subject }}">Process#}
{# </button>#}
{# <span class="font-italic font-weight-bolder text-success">Processing</span>#}
</td>
</tr>
......
......@@ -294,8 +294,11 @@ def video_result(request):
# due_lecture_video_name = "Test.mp4"
print('due lecture video name: ', due_lecture_video_name)
# check whether there are due lectures or not
isDue = len(due_lecture_list)
return render(request, "FirstApp/video_results.html",
{"lecturer": lecturer, "due_lectures": due_lecture_list, "due_lecture_video_name": due_lecture_video_name})
{"lecturer": lecturer, "due_lectures": due_lecture_list, "due_lecture_video_name": due_lecture_video_name, 'isDue': isDue})
# view for emotion page
......
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