Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Pariksha
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roshan Rabinarayan
Pariksha
Commits
cc394767
Commit
cc394767
authored
Nov 06, 2020
by
Roshan Rabinarayan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added add_quiz functionality
parent
8cd457b2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
4 deletions
+37
-4
QuizSystem/__pycache__/urls.cpython-38.pyc
QuizSystem/__pycache__/urls.cpython-38.pyc
+0
-0
QuizSystem/urls.py
QuizSystem/urls.py
+4
-1
db.sqlite3
db.sqlite3
+0
-0
quiz/__pycache__/views.cpython-38.pyc
quiz/__pycache__/views.cpython-38.pyc
+0
-0
quiz/static/js/quiz_create_page.js
quiz/static/js/quiz_create_page.js
+1
-1
quiz/templates/quiz_create.html
quiz/templates/quiz_create.html
+1
-1
quiz/views.py
quiz/views.py
+31
-1
No files found.
QuizSystem/__pycache__/urls.cpython-38.pyc
View file @
cc394767
No preview for this file type
QuizSystem/urls.py
View file @
cc394767
...
...
@@ -35,6 +35,9 @@ urlpatterns = [
url
(
r'^upload/'
,
TemplateView
.
as_view
(
template_name
=
'upload.html'
)),
url
(
'instructor/'
,
a
.
instructor
),
path
(
'uploaded/'
,
a
.
upload_file
,
name
=
"uploaded"
),
path
(
'sign_up/'
,
a
.
sign_up
,
name
=
"sign-up"
),
path
(
'accounts/'
,
include
(
'django.contrib.auth.urls'
)),
path
(
'create_quiz/'
,
a
.
create_quiz
)
path
(
'create_quiz/'
,
a
.
create_quiz
),
path
(
'add_quiz/'
,
a
.
add_quiz
),
]
+
static
(
settings
.
STATIC_URL
,
document_root
=
settings
.
STATIC_ROOT
)
db.sqlite3
View file @
cc394767
No preview for this file type
quiz/__pycache__/views.cpython-38.pyc
View file @
cc394767
No preview for this file type
quiz/static/js/quiz_create_page.js
View file @
cc394767
...
...
@@ -27,7 +27,7 @@
<button type="button" id="del_question" class="del_question" onclick="del_que(`
+
next_qnumber
+
`)">Delete this question</button>
</div>
<h3>Question:</h3>
<textarea class="input_area" onchange="fillme(this)"></textarea>
<textarea class="input_area"
name="question_`
+
next_qnumber
+
`"
onchange="fillme(this)"></textarea>
<h3>Options:</h3>
<label class="op_box" id="box0"><span id="lbl_`
+
next_qnumber
+
`_0"><strong>A</strong><span role="textbox" id="span_`
+
next_qnumber
+
`_option0" contenteditable class="ques_txtara"></span></span></label>
<label class="op_box" id="box1"><span id="lbl_`
+
next_qnumber
+
`_1"><strong>B</strong><span role="textbox" id="span_`
+
next_qnumber
+
`_option1" contenteditable class="ques_txtara"></span></span></label>
...
...
quiz/templates/quiz_create.html
View file @
cc394767
...
...
@@ -10,7 +10,7 @@
</head>
<body
onload=
"add_que()"
>
<section>
<form
action=
"
add_quiz
"
id=
"quiz_create_form"
enctype =
"multipart/form-data"
method =
"POST"
>
{% csrf_token %}
<form
action=
"
/add_quiz/
"
id=
"quiz_create_form"
enctype =
"multipart/form-data"
method =
"POST"
>
{% csrf_token %}
<div
id=
"quiz_controls"
>
<p><a
href=
"../upload"
>
Click here to automatically add all questions by uploading csv
</a></p>
<div
style=
"padding: 20px"
>
...
...
quiz/views.py
View file @
cc394767
...
...
@@ -168,7 +168,7 @@ def instructor(request):
allStudents
.
append
(
student
[
'studentId'
])
std
=
np
.
std
(
allMarks
)
mean
=
np
.
mean
(
allMarks
)
ax
.
hist
(
allMarks
,
allStudents
)
ax
.
scatter
(
allMarks
,
allStudents
)
html_graph
=
mpld3
.
fig_to_html
(
fig
)
fig1
,
ax1
=
plt
.
subplots
()
mu
=
mean
...
...
@@ -234,3 +234,33 @@ def view_sub(request):
return
render
(
request
,
'view_submissions.html'
,
{
'submissions'
:
subs
,
'score'
:
score
,
'total'
:
total
})
def
add_quiz
(
request
):
vals
=
list
()
for
req
in
request
.
POST
.
values
():
vals
.
append
(
req
)
i
=
1
quizCode
=
vals
[
i
]
print
(
quizCode
)
i
+=
1
date
=
vals
[
i
]
print
(
date
)
i
+=
1
startTime
=
vals
[
i
]
print
(
startTime
)
i
+=
1
length
=
vals
[
i
]
print
(
length
)
i
+=
1
print
(
request
.
user
)
q
=
quiz
(
length
=
length
,
quizCode
=
quizCode
,
quizInfo
=
''
,
date
=
date
,
quizInstructor
=
str
(
request
.
user
),
startTime
=
startTime
,
quizDone
=
False
)
q
.
save
()
while
(
i
<
len
(
vals
)):
row
=
(
vals
[
i
],
vals
[
i
+
1
],
vals
[
i
+
2
],
vals
[
i
+
3
],
vals
[
i
+
4
],
vals
[
i
+
5
],
vals
[
i
+
6
],
vals
[
i
+
7
],
vals
[
i
+
8
])
q1
=
Questions
(
question
=
row
[
0
],
option1
=
row
[
1
],
option2
=
row
[
2
],
option3
=
row
[
3
],
option4
=
row
[
4
],
answer
=
row
[
7
],
marks
=
int
(
row
[
5
]),
negative
=
float
(
row
[
6
]),
explainations
=
row
[
7
],
quizCode
=
quizCode
,
quizId
=
q
)
#hardcoded quizid
q1
.
save
()
i
=
i
+
9
return
HttpResponse
(
'sucess'
)
#(request,'success')
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment