Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
zesje
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Works on my machine
zesje
Commits
a75a9e97
Commit
a75a9e97
authored
5 years ago
by
Ruben Young On
Browse files
Options
Downloads
Patches
Plain Diff
Added function to get all checkboxes for one exam
parent
691930e9
No related branches found
No related tags found
1 merge request
!6
Draw pdf box
Pipeline
#17445
passed
5 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
zesje/api/__init__.py
+1
-0
1 addition, 0 deletions
zesje/api/__init__.py
zesje/api/exams.py
+14
-2
14 additions, 2 deletions
zesje/api/exams.py
with
15 additions
and
2 deletions
zesje/api/__init__.py
+
1
−
0
View file @
a75a9e97
...
...
@@ -12,6 +12,7 @@ from .solutions import Solutions
from
.widgets
import
Widgets
from
.emails
import
EmailTemplate
,
RenderedEmailTemplate
,
Email
from
.mult_choice
import
MultipleChoice
from
.
import
signature
from
.
import
images
from
.
import
summary_plot
...
...
This diff is collapsed.
Click to expand it.
zesje/api/exams.py
+
14
−
2
View file @
a75a9e97
...
...
@@ -10,7 +10,7 @@ from werkzeug.datastructures import FileStorage
from
sqlalchemy.orm
import
selectinload
from
..pdf_generation
import
generate_pdfs
,
output_pdf_filename_format
,
join_pdfs
,
page_is_size
from
..database
import
db
,
Exam
,
ExamWidget
,
Submission
from
..database
import
db
,
Exam
,
ExamWidget
,
Submission
,
MultipleChoiceOption
PAGE_FORMATS
=
{
"
A4
"
:
(
595.276
,
841.89
),
...
...
@@ -313,15 +313,27 @@ class ExamGeneratedPdfs(Resource):
generated_pdfs_dir
=
self
.
_get_generated_exam_dir
(
exam_dir
)
os
.
makedirs
(
generated_pdfs_dir
,
exist_ok
=
True
)
cb_data
=
self
.
get_cb_data_for_exam
(
exam
)
generate_pdfs
(
exam_path
,
exam
.
token
,
copy_nums
,
pdf_paths
,
student_id_widget
.
x
,
student_id_widget
.
y
,
barcode_widget
.
x
,
barcode_widget
.
y
barcode_widget
.
x
,
barcode_widget
.
y
,
cb_data
=
cb_data
)
def
get_cb_data_for_exam
(
self
,
exam
):
problem_ids
=
[
problem
.
id
for
problem
in
exam
.
problems
]
cb_data
=
MultipleChoiceOption
.
query
.
filter
(
MultipleChoiceOption
.
id
in
problem_ids
).
all
()
return
cb_data
def
get_id
(
problem
):
return
problem
.
id
post_parser
=
reqparse
.
RequestParser
()
post_parser
.
add_argument
(
'
copies_start
'
,
type
=
int
,
required
=
True
)
post_parser
.
add_argument
(
'
copies_end
'
,
type
=
int
,
required
=
True
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment