From 9781b3f83f444d14f576418afb9325d6998b3475 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 3 Feb 2021 23:58:15 +0530 Subject: [PATCH] QUiz student changes --- db.sqlite3 | Bin 524288 -> 528384 bytes lms/templates/lms/course/course_base.html | 2 +- lms/templates/quiz/QuizAll.html | 30 ++++ lms/templates/quiz/quiz_instructions.html | 40 +++++ lms/templates/quiz/studentQuiz.html | 205 ++++++++++++++++++++++ lms/urls.py | 31 ++-- lms/views/quiz/quiz_views.py | 65 +++++++ 7 files changed, 357 insertions(+), 16 deletions(-) create mode 100644 lms/templates/quiz/QuizAll.html create mode 100644 lms/templates/quiz/quiz_instructions.html create mode 100644 lms/templates/quiz/studentQuiz.html diff --git a/db.sqlite3 b/db.sqlite3 index 5111fd074047913a0ecef2619ab259c201775d52..549a48b2ed1d999ccb48cef86d0204e3d533d0a0 100644 GIT binary patch delta 2144 zcmah~Yj6|S72YfDLyz4(JPbC)7HdM{5?As*q}8L75E+|?UB$IAwMm-VLJzEmC0S3~ zGsHIhXwylEsoL2eoepg$nM`JwBt&iXCqG;|A=H6F0%_9_XbOQq;y_3WA*3O_60g!s zhdVo~(Vp*~^WFP>=ibRlVe;3)^it{|K@d|rg;nU_p21C4Fte@t1{5F8423{f-HGNr$>}+F2&(+%f(%hw@Cg?;>n^{_{qz$-Ka*kin1W7 z9#Qm2vdtknosw9bi67;rYFLh#TIn^`a-6ZaCssF+NTk9{eb7o73Tz zWYHfSjwJpk?DWWXn`#$T(LJ?7U*%w^<-Thux)Oa$FkPjRM7DbzE}PxqcDv+kD3g_o zSBIAsCx)5QUlJ;!P4E-}Pn8U*?O-zMYf-fhThb|*y;DdfGCCpguL6Y z>?&W`h1gV`i9bU?GaP|e;91xK{ZQb)f*SrzsWCOn*Dhjd;vNH97z~B|xp>wVO>JQ} z_O32}WzjLH&IB_$I0{$cU+^Kk4=3PlH~{-#rqnq74A7JwA(k!gYtcQJ;wd;uRDtK= zESxOOf9ddb08N+AzNo98$LioR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/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 +
    + + + + + + \ 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'])