diff --git a/db.sqlite3 b/db.sqlite3 index 5111fd0..549a48b 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/lms/templates/lms/course/course_base.html b/lms/templates/lms/course/course_base.html index 76ad9d6..aa29a99 100644 --- a/lms/templates/lms/course/course_base.html +++ b/lms/templates/lms/course/course_base.html @@ -91,7 +91,7 @@ - Quizes + Quizes diff --git a/lms/templates/quiz/QuizAll.html b/lms/templates/quiz/QuizAll.html new file mode 100644 index 0000000..6990796 --- /dev/null +++ b/lms/templates/quiz/QuizAll.html @@ -0,0 +1,30 @@ + + + + + + + Capstone Quiz App + {% load static %} + + + + + +
+

Quizzes

+
+ +
+ {% for quiz in quizs%} + {% csrf_token %} +
  • +

    {{ quiz.Quizname }}

  • + {% endfor %} +
    + + + + + \ No newline at end of file diff --git a/lms/templates/quiz/quiz_instructions.html b/lms/templates/quiz/quiz_instructions.html new file mode 100644 index 0000000..805a8a2 --- /dev/null +++ b/lms/templates/quiz/quiz_instructions.html @@ -0,0 +1,40 @@ + + + + + + + Capstone Quiz App + {% load static %} + + + + + +
    +

    {{ quizname}}

    +
    + +
    +

    Due Apr 29, 2019 at 5:30pm + Points 100
    + Available until Jan 29, 2021 at 5:30pm + Time Limit 30 Minutes

    +
    + +
    +

    Instructions

    + 1. You have 30 minutes to attempt the quiz
    + 2. Once you start the quiz, you cannot go back and re-attempt it
    + 3. You will not find answers online, so please make sure you are ready for the quiz
    + 4. For Multiple Answer Questions, ALL the answers must be correct to score any point +
    +
    +

    Start Quiz

    +
    + + + + + \ No newline at end of file diff --git a/lms/templates/quiz/studentQuiz.html b/lms/templates/quiz/studentQuiz.html new file mode 100644 index 0000000..e284180 --- /dev/null +++ b/lms/templates/quiz/studentQuiz.html @@ -0,0 +1,205 @@ + + +{% block content %} +
    +

    {{ quiz.Quizname }}

    + Time : + + + +
    +
    + {% for quest in questions %} +
    +
    + +

    Question {{ forloop.counter }} + +

    + +
    +

    {{ quest.question | safe }}

    +

    {{ quest.description | safe }}

    +
    + +
    +
    + {% if quest.img %} + + {% endif %} +
    + + {% if quest.questiontype == "Multiple choice" %} +

     {{ quest.option1 }}

    +

     {{ quest.option2 }}

    + + {% if quest.option3 != "" and quest.option4 != "" %} +

     {{ quest.option3 }}

    +

     {{ quest.option4 }}

    + {% endif %} + {% elif quest.questiontype == "Multiple correct" %} + +

     {{ quest.option1 }}

    +

     {{ quest.option2 }}

    + + {% if quest.option3 != "" and quest.option4 != "" %} +

     {{ quest.option3 }}

    +

     {{ quest.option4 }}

    + {% endif %} + {% elif quest.questiontype == "True or False" %} + +

     {{ quest.option1 }}

    +

     {{ quest.option2 }}

    + + {% endif %} + +
    + +
    + +

    +
    +

    +
    +
    + {% endfor %} + +

    Have question for us

    + +
    + +
    + +
    + + +
    +{% endblock content %} + +{% block scripts %} + + + + + + + + + + +{% endblock scripts %} \ No newline at end of file diff --git a/lms/urls.py b/lms/urls.py index f617b96..6a71c7f 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -38,7 +38,7 @@ from lms.views.course.course_views import ( CourseListView, GradeBookCourseView, - StudentGradeBookCourseView, CourseCreateView + StudentGradeBookCourseView # table_download ) from lms.views.course.grading_scheme_view import ( @@ -79,7 +79,10 @@ preview_quiz, enter_quiz_comment, quiz_publish, QuizCreateView, QuizUpdateView, QuizDeleteView, - QuizQuestionCreateView, QuizQuestionUpdateView, QuizQuestionDeleteView + QuizQuestionCreateView, QuizQuestionUpdateView, QuizQuestionDeleteView, + quiz_instructions, + quizzes, + studentQuiz ) # Specifies the app name for name spacing. @@ -219,11 +222,6 @@ name="course_unpublish" ), - path( - route="course/create/", - view=CourseCreateView.as_view(), - name="course_create" - ), # /author/notification/ path( route="notifications/", @@ -305,8 +303,7 @@ # By Quiz Teacher View Team.[Start] path('course//quiz/course_stats/', compute_stats, name="compute_stats"), - path('course//quiz//one_at_a_time/', fetch_questions_one_at_a_time, - name="fetch_questions_one_at_a_time"), + path('course//quiz//one_at_a_time/', fetch_questions_one_at_a_time, name="fetch_questions_one_at_a_time"), path('course//quiz//fetch_questions/', fetch_questions, name="fetch_questions"), @@ -316,12 +313,9 @@ path('course//quiz//update/', QuizUpdateView.as_view(), name="quiz_update"), path('course//quiz//delete/', QuizDeleteView.as_view(), name="quiz_delete"), - path('course//quiz//question/create', QuizQuestionCreateView.as_view(), - name="quiz_question_create"), - path('course//quiz//question//update/', QuizQuestionUpdateView.as_view(), - name="quiz_question_update"), - path('course//quiz//question//delete/', QuizQuestionDeleteView.as_view(), - name="quiz_question_delete"), + path('course//quiz//question/create', QuizQuestionCreateView.as_view(), name="quiz_question_create"), + path('course//quiz//question//update/', QuizQuestionUpdateView.as_view(), name="quiz_question_update"), + path('course//quiz//question//delete/', QuizQuestionDeleteView.as_view(), name="quiz_question_delete"), path('course//quiz//detail/', quiz_detail, name="quiz_view"), @@ -332,6 +326,13 @@ path('course//quiz//publish/', quiz_publish, name='quiz_publish'), # By Quiz Teacher View Team.[End] + # By Quiz Student Team - START + path('course//quiz/quizzes/', quizzes, name='quizzes'), + path('course//quiz/quiz_instructions/', quiz_instructions, name='quiz_instructions'), + path('course//quiz/studentQuiz/', studentQuiz, name='studentQuiz'), + + # By Quiz Student Team - END + # Assignment Views path( route="course//student_assignment/home/", diff --git a/lms/views/quiz/quiz_views.py b/lms/views/quiz/quiz_views.py index be72475..28d2462 100644 --- a/lms/views/quiz/quiz_views.py +++ b/lms/views/quiz/quiz_views.py @@ -28,6 +28,71 @@ def fetch_questions(request, *args, **kwargs): return render(request, 'quiz/fetch_questions.html', context) +# Fetch Quiz instructions for student +def quiz_instructions(request, *args, **kwargs): + quiz_pk_id = '' + quiz_name = '' + print("query string....",request.GET['Quiz'],request.GET['QuizName']) + + if request.GET['Quiz'] is not None: + quiz_pk_id = str(request.GET['Quiz']) + + if request.GET['QuizName'] is not None: + quiz_name = str(request.GET['QuizName']) + + #questions = Question.objects.filter(quiz__id=kwargs['pk']) + quizs = Quiz.objects.filter(course_id = kwargs['course_id']) + print("inst...",quizs) + context = {'course_id': kwargs['course_id'], + 'object': Course.objects.get(id=kwargs['course_id']), + #'pk': kwargs['pk'], + #'questions': questions, + 'quizid': str(quiz_pk_id), + 'quizname':str(quiz_name) + } + return render(request, 'quiz/quiz_instructions.html', context) + +# Fetch Quiz instructions for student +def quizzes(request, *args, **kwargs): + quizs = Quiz.objects.filter(course_id = kwargs['course_id']) + print("here...",quizs) + context = {'course_id': kwargs['course_id'], + 'object':Course.objects.get(id=kwargs['course_id']), + #'pk': kwargs['pk'], + #'questions': questions, + 'quizs': quizs + } + print("quizzes",context) + return render(request, 'quiz/QuizAll.html', context) + + +# Fetch Quiz instructions for student +def studentQuiz(request, *args, **kwargs): + # quizs = Quiz.objects.filter(course_id = kwargs['course_id']) + # context = {'course_id': kwargs['course_id'], + # 'object':Course.objects.get(id=kwargs['course_id']), + # #'pk': kwargs['pk'], + # #'questions': questions, + # 'quizs': quizs + # } + + + quiz_pk_id = '' + if request.GET['Quiz'] is not None: + quiz_pk_id = str(request.GET['Quiz']) + print("in student quiz page...",quiz_pk_id) + + #quiz_id = Quiz.objects.all(course_id=kwargs['course_id'],Quizname = quizname) + #print("quiz id...student quiz details",quiz_pk_id) + questions = Question.objects.filter(quiz__id=quiz_pk_id) + context = {'questions': questions, + 'course_id': kwargs['course_id'], + 'quiz': Quiz.objects.get(id=quiz_pk_id), + 'object': Course.objects.get(id=kwargs['course_id'])} + #print("quizzes",context) + return render(request, 'quiz/studentQuiz.html', context) + + # Fetch one quiz question at a time. def fetch_questions_one_at_a_time(request, *args, **kwargs): obj = Question.objects.filter(quiz__id=kwargs['pk'])