Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
grady
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Jan Maximilian Michal
grady
Commits
421a5078
Commit
421a5078
authored
5 years ago
by
robinwilliam.hundt
Browse files
Options
Downloads
Patches
Plain Diff
Fixed importer
parent
34012314
No related branches found
Branches containing commit
Tags
0.3.4
Tags containing commit
1 merge request
!161
Fixed importer
Pipeline
#93815
passed
5 years ago
Stage: build
Stage: test
Stage: build_image
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
util/importer.py
+6
-14
6 additions, 14 deletions
util/importer.py
with
6 additions
and
14 deletions
util/importer.py
+
6
−
14
View file @
421a5078
import
json
import
os
import
readline
import
util
from
util.messages
import
warn
from
core.models
import
ExamType
,
Feedback
,
Submission
,
SubmissionType
,
Test
...
...
@@ -35,15 +34,11 @@ valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False}
ORIGIN_ORDER
=
{
Feedback
.
WAS_EMPTY
,
Feedback
.
DID_NOT_COMPILE
,
Feedback
.
COULD_NOT_LINK
,
Feedback
.
FAILED_UNIT_TESTS
,
}
TEST_ORDER
=
(
util
.
processing
.
EmptyTest
.
__name__
,
util
.
processing
.
CompileTest
.
__name__
,
util
.
processing
.
LinkTest
.
__name__
,
util
.
processing
.
UnitTestTest
.
__name__
,
'
EmptyTest
'
,
'
CompileTest
'
,
)
FEEDBACK_MAPPER
=
dict
(
zip
(
TEST_ORDER
,
ORIGIN_ORDER
))
...
...
@@ -129,7 +124,7 @@ def load_hektor_json():
exam
,
_
=
ExamType
.
objects
.
get_or_create
(
**
exam_data
[
'
module
'
])
for
submission_type
in
exam
[
'
submission_types
'
]:
for
submission_type
in
exam
_data
[
'
submission_types
'
]:
SubmissionType
.
objects
.
get_or_create
(
**
submission_type
)
for
student
in
exam_data
[
'
students
'
]:
...
...
@@ -183,12 +178,9 @@ def add_tests(submission_obj, tests):
def
add_feedback_if_test_recommends_it
(
test_obj
):
available_tests
=
util
.
processing
.
Test
.
available_tests
()
if
test_obj
.
label
==
available_tests
[
test_obj
.
name
].
label_failure
\
and
not
hasattr
(
test_obj
.
submission
,
'
feedback
'
)
\
and
(
test_obj
.
name
==
util
.
processing
.
EmptyTest
.
__name__
or
test_obj
.
name
==
util
.
processing
.
CompileTest
.
__name__
):
# TODO rework this brittle code
if
(
test_obj
.
label
==
'
EMPTY
'
or
test_obj
.
label
==
'
COMPILATION_FAILED
'
)
\
and
not
hasattr
(
test_obj
.
submission
,
'
feedback
'
):
return
Feedback
.
objects
.
update_or_create
(
of_submission
=
test_obj
.
submission
,
defaults
=
{
...
...
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