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
3215185b
You need to sign in or sign up before continuing.
Commit
3215185b
authored
5 years ago
by
Ruben Young On
Browse files
Options
Downloads
Patches
Plain Diff
Changed pregrade function
parent
b397235d
No related branches found
Branches containing commit
No related tags found
1 merge request
!17
Add pregrading
Pipeline
#17844
passed with warnings
5 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
zesje/pregrader.py
+14
-6
14 additions, 6 deletions
zesje/pregrader.py
zesje/scans.py
+1
-2
1 addition, 2 deletions
zesje/scans.py
with
15 additions
and
8 deletions
zesje/pregrader.py
+
14
−
6
View file @
3215185b
...
...
@@ -9,7 +9,7 @@
# coupled feedback cannot be deleted
from
zesje.database
import
db
,
Exam
,
Submission
from
zesje.database
import
db
,
Exam
,
Submission
,
Solution
def
pregrade
(
exam_token
,
image
):
...
...
@@ -28,24 +28,32 @@ def pregrade(exam_token, image):
def
add_feedback_to_solution
(
page_img
,
barcode
):
"""
Adds the multiple choice options that are identified as marked as a feedback option to a solution
Params
------
page_img: image of the page
barcode: data from the barcode on the page
"""
exam
=
Exam
.
query
.
filter
(
Exam
.
token
==
barcode
.
token
).
first
()
sub
=
Submission
.
query
.
filter
(
Submission
.
copy_number
==
barcode
.
copy
,
Submission
.
exam_id
==
exam
.
id
).
one_or_none
()
problems
=
exam
.
problems
problems_on_page
=
list
(
filter
(
lambda
p
:
p
.
widget
.
page
==
barcode
.
page
,
problems
))
problems_on_page
=
[
p
for
p
in
exam
.
problems
if
p
.
widget
.
page
==
barcode
.
page
]
for
problem
in
problems_on_page
:
for
mc_option
in
problem
.
mc_options
:
box
=
(
mc_option
.
x
,
mc_option
.
y
)
# check width and so forth
sol
=
[
s
for
s
in
sub
.
solutions
if
s
.
submission_id
==
sub
.
id
]
# check if box is filled
if
box_is_filled
(
box
,
page_img
):
s
ub
.
feedback
=
mc_option
.
feedback
s
ol
.
feedback
=
mc_option
.
feedback
db
.
session
.
commit
()
def
box_is_filled
(
box
,
image
):
def
box_is_filled
(
box
,
page_img
):
pass
...
...
This diff is collapsed.
Click to expand it.
zesje/scans.py
+
1
−
2
View file @
3215185b
...
...
@@ -241,8 +241,7 @@ def process_page(image_data, exam_config, output_dir=None, strict=False):
return
True
,
"
Testing, image not saved and database not updated.
"
update_database
(
image_path
,
barcode
)
add_feedback_to_solution
()
add_feedback_to_solution
(
image_array
,
barcode
)
if
barcode
.
page
==
0
:
description
=
guess_student
(
...
...
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