Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions markanddisplayscore.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from yaksh.models import Quiz
from yaksh.views import *
def markquestions(lst1, lst2):
return list(set(lst1) & set(lst2))

def displayscore(ans,user_inputs):
len_of_input=len(ans)
score=len(markquestions(ans,user_inputs))
print("your score is: ",score, '/',len_of_input)



def get_questionid():
print(models.Quiz)
4 changes: 2 additions & 2 deletions yaksh/templates/yaksh/complete.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ <h5>
<br>
{% if module_id and not paper.course.is_trial %}
{% if first_unit %}
<a href="{% url 'yaksh:next_unit' course_id module_id learning_unit.id '1' %}" class="btn btn-info btn-lg" id="Next"> Next
<a href="{% url 'yaksh:grade' course_id module_id learning_unit.id '1' %}" class="btn btn-info btn-lg" id="Next"> Next
<span class="fa fa-step-forward">
</span>
</a>
{% else %}
<a href="{% url 'yaksh:next_unit' course_id module_id learning_unit.id %}" class="btn btn-info btn-lg" id="Next"> Next
<a href="{% url 'yaksh:grade' module_id %}" class="btn btn-info btn-lg" id="Next"> Next
<span class="fa fa-step-forward">
</span>
</a>
Expand Down
4 changes: 4 additions & 0 deletions yaksh/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
url(r'^new_activation/$', views.new_activation, name='new_activation'),
url(r'^toggle_moderator/$', views.toggle_moderator_role,
name='toggle_moderator'),
url(r'^score/$',views.displaygrade,name="grade"),
url(r'^score/(?P<questionpaper_id>\d+)$', views.displaygrade, name="grade"),

url(r'^quizzes/$', views.quizlist_user, name='quizlist_user'),
url(r'^results/$', views.results_user),
url(r'^start/(?P<questionpaper_id>\d+)/(?P<module_id>\d+)/'
Expand Down Expand Up @@ -184,6 +187,7 @@
'(?P<course_id>\d+)/$', views.test_quiz, name="test_quiz"),
url(r'^manage/create_demo_course/$', views.create_demo_course,
name="create_demo_course"),

url(r'^manage/courses/download_course_csv/(?P<course_id>\d+)/$',
views.download_course_csv, name="download_course_csv"),
url(r'^manage/download/user_assignment/(?P<question_id>\d+)/'
Expand Down
26 changes: 25 additions & 1 deletion yaksh/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
from django.core.exceptions import (
MultipleObjectsReturned, ObjectDoesNotExist
)
import datetime
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.contrib import messages
from taggit.models import Tag
from django.urls import reverse
from django.conf import settings
import json
import numpy as np
from textwrap import dedent
import zipfile
import markdown
Expand Down Expand Up @@ -1056,10 +1058,12 @@ def complete(request, reason=None, attempt_num=None, questionpaper_id=None,

paper.update_marks()
paper.set_end_time(timezone.now())
questionpaper_id=str(paper.question_paper.id)

message = reason or "Quiz has been submitted"
context = {'message': message, 'paper': paper,
'module_id': learning_module.id,
'course_id': course_id, 'learning_unit': learning_unit}
'course_id': course_id, 'learning_unit': learning_unit,questionpaper_id:'questionpaper_id'}
if is_moderator(user):
context['user'] = "moderator"
return my_render_to_response(request, 'yaksh/complete.html', context)
Expand Down Expand Up @@ -4233,3 +4237,23 @@ def upload_download_course_md(request, course_id):
'is_upload_download_md': True,
}
return my_render_to_response(request, 'yaksh/course_detail.html', context)


@login_required
@email_verified
def displaygrade(request,questionpaper_id):
uuser=request.user
idd=questionpaper_id
print(idd)
x=datetime.datetime.now()
a=AnswerPaper.objects.all().filter(user=uuser).filter(question_paper_id=idd).values()
for item in a :
item['marks_obtained']
grade=item['marks_obtained']
precent=item['percent']
times=item['end_time']
context = {
'precent': precent,
'user':uuser
}
return render(request,'displayscore.html',context)