summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authoradityacp2020-09-30 08:56:36 +0530
committeradityacp2020-09-30 08:56:36 +0530
commit2dcaa3847c4faefd14ee88b9a2370e1d83e747f0 (patch)
treed5e05823f9b6524469a78073e60857841dba07aa /yaksh/views.py
parent4ab3353b4a6dc28764c8536e6b089f7feb65f015 (diff)
parented81054c05ff297ea241ce08664e0d2323da115c (diff)
downloadonline_test-2dcaa3847c4faefd14ee88b9a2370e1d83e747f0.tar.gz
online_test-2dcaa3847c4faefd14ee88b9a2370e1d83e747f0.tar.bz2
online_test-2dcaa3847c4faefd14ee88b9a2370e1d83e747f0.zip
Resolve Conflicts
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index be19d19..a3d7def 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -668,6 +668,7 @@ def show_question(request, question, paper, error_message=None,
quiz = paper.question_paper.quiz
quiz_type = 'Exam'
can_skip = False
+ assignment_files = []
if previous_question:
delay_time = paper.time_left_on_question(previous_question)
else:
@@ -709,6 +710,13 @@ def show_question(request, question, paper, error_message=None,
test_cases = question.get_ordered_test_cases(paper)
else:
test_cases = question.get_test_cases()
+ if question.type == 'upload':
+ assignment_files = AssignmentUpload.objects.filter(
+ assignmentQuestion_id=question.id,
+ course_id=course_id,
+ user=request.user,
+ question_paper_id=paper.question_paper_id
+ )
files = FileUpload.objects.filter(question_id=question.id, hide=False)
course = Course.objects.get(id=course_id)
module = course.learning_module.get(id=module_id)
@@ -728,6 +736,7 @@ def show_question(request, question, paper, error_message=None,
'delay_time': delay_time,
'quiz_type': quiz_type,
'all_modules': all_modules,
+ 'assignment_files': assignment_files,
}
answers = paper.get_previous_answers(question)
if answers:
@@ -1920,8 +1929,8 @@ def grade_user(request, quiz_id=None, user_id=None, attempt_number=None,
course.is_teacher(current_user):
raise Http404('This course does not belong to you')
has_quiz_assignments = AssignmentUpload.objects.filter(
- question_paper_id__in=questionpaper_id
- ).exists()
+ course_id=course_id, question_paper_id__in=questionpaper_id
+ ).exists()
context = {
"users": user_details,
"quiz_id": quiz_id,
@@ -1940,9 +1949,9 @@ def grade_user(request, quiz_id=None, user_id=None, attempt_number=None,
except IndexError:
raise Http404('No attempts for paper')
has_user_assignments = AssignmentUpload.objects.filter(
- question_paper_id__in=questionpaper_id,
- user_id=user_id
- ).exists()
+ course_id=course_id, question_paper_id__in=questionpaper_id,
+ user_id=user_id
+ ).exists()
user = User.objects.get(id=user_id)
data = AnswerPaper.objects.get_user_data(
user, questionpaper_id, course_id, attempt_number
@@ -2203,12 +2212,12 @@ def view_answerpaper(request, questionpaper_id, course_id):
if quiz.view_answerpaper and user in course.students.all():
data = AnswerPaper.objects.get_user_data(user, questionpaper_id,
course_id)
- has_user_assignment = AssignmentUpload.objects.filter(
+ has_user_assignments = AssignmentUpload.objects.filter(
user=user, course_id=course.id,
question_paper_id=questionpaper_id
).exists()
context = {'data': data, 'quiz': quiz, 'course_id': course.id,
- "has_user_assignment": has_user_assignment}
+ "has_user_assignments": has_user_assignments}
return my_render_to_response(
request, 'yaksh/view_answerpaper.html', context
)