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
ad3af33f
Commit
ad3af33f
authored
7 years ago
by
Jan Maximilian Michal
Browse files
Options
Downloads
Patches
Plain Diff
Change definition of submissiion pool and fixed error messages
parent
e440f555
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
core/models.py
+18
-10
18 additions, 10 deletions
core/models.py
core/templates/core/message_box.html
+1
-1
1 addition, 1 deletion
core/templates/core/message_box.html
core/views/feedback.py
+11
-6
11 additions, 6 deletions
core/views/feedback.py
with
30 additions
and
17 deletions
core/models.py
+
18
−
10
View file @
ad3af33f
...
@@ -50,7 +50,6 @@ from django.db.models import Q
...
@@ -50,7 +50,6 @@ from django.db.models import Q
SLUG_LENGTH
=
16
SLUG_LENGTH
=
16
def
random_slug
():
def
random_slug
():
return
''
.
join
(
sample
(
ascii_lowercase
,
SLUG_LENGTH
))
return
''
.
join
(
sample
(
ascii_lowercase
,
SLUG_LENGTH
))
...
@@ -125,7 +124,7 @@ class Submission(models.Model):
...
@@ -125,7 +124,7 @@ class Submission(models.Model):
)
)
@classmethod
@classmethod
def
assign_tutor
(
cls
,
tutor
,
type_
slug
=
None
)
->
bool
:
def
assign_tutor
(
cls
,
tutor
,
slug
=
None
)
->
bool
:
"""
Assigns a tutor to a submission
"""
Assigns a tutor to a submission
A submission is not assigned to the specified tutor in the case
A submission is not assigned to the specified tutor in the case
...
@@ -144,18 +143,27 @@ class Submission(models.Model):
...
@@ -144,18 +143,27 @@ class Submission(models.Model):
if
unfinished
:
if
unfinished
:
return
False
return
False
ready
=
cls
.
objects
.
filter
(
feedback__isnull
=
True
)
candidates
=
cls
.
objects
.
filter
(
(
Q
(
feedback__isnull
=
True
)
|
Q
(
feedback__origin
=
Feedback
.
DID_NOT_COMPILE
)
|
Q
(
feedback__origin
=
Feedback
.
COULD_NOT_LINK
)
)
&
~
Q
(
feedback__of_tutor
=
tutor
)
)
# we want a submission of a specific type
if
slug
:
candidates
=
candidates
.
filter
(
type__slug
=
slug
)
# we do not want this tutor to correct the same submission twice
# we couldn't find any submission to correct
if
type_slug
:
if
not
candidates
:
ready
=
ready
.
filter
(
type__slug
=
type_slug
)
ready
=
ready
.
exclude
(
feedback__of_tutor
=
tutor
)
if
not
ready
:
return
False
return
False
submission
=
ready
[
0
]
submission
=
candidates
[
0
]
feedback
=
Feedback
()
feedback
=
submission
.
feedback
if
hasattr
(
submission
,
'
feedback
'
)
else
Feedback
()
feedback
.
origin
=
Feedback
.
MANUAL
feedback
.
origin
=
Feedback
.
MANUAL
feedback
.
status
=
Feedback
.
EDITABLE
feedback
.
of_tutor
=
tutor
feedback
.
of_tutor
=
tutor
feedback
.
of_submission
=
submission
feedback
.
of_submission
=
submission
feedback
.
save
()
feedback
.
save
()
...
...
This diff is collapsed.
Click to expand it.
core/templates/core/message_box.html
+
1
−
1
View file @
ad3af33f
{# This is where all the messages pop up #}
{# This is where all the messages pop up #}
{% if messages %}
{% if messages
or form.errors
%}
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col my-2"
>
<div
class=
"col my-2"
>
{% for message in messages %}
{% for message in messages %}
...
...
This diff is collapsed.
Click to expand it.
core/views/feedback.py
+
11
−
6
View file @
ad3af33f
...
@@ -72,13 +72,18 @@ class FeedbackEdit(UpdateView):
...
@@ -72,13 +72,18 @@ class FeedbackEdit(UpdateView):
# ugly needs patch
# ugly needs patch
if
'
Next
'
in
self
.
request
.
POST
[
'
update
'
]:
if
'
Next
'
in
self
.
request
.
POST
[
'
update
'
]:
if
in_groups
(
self
.
request
.
user
,
(
'
Reviewers
'
,)):
if
in_groups
(
self
.
request
.
user
,
(
'
Reviewers
'
,)):
needs_review
=
Feedback
.
objects
.
filter
(
status
=
Feedback
.
NEEDS_REVIEW
,
of_submission__type
=
form
.
instance
.
of_submission
.
type
)
needs_review
=
needs_review
[
0
]
if
needs_review
else
None
needs_review
=
Feedback
.
objects
.
filter
(
status
=
Feedback
.
NEEDS_REVIEW
,
of_submission__type
=
form
.
instance
.
of_submission
.
type
)
if
needs_review
:
if
needs_review
:
return
HttpResponseRedirect
(
reverse
(
'
FeedbackEdit
'
,
args
=
(
needs_review
.
slug
,)))
return
HttpResponseRedirect
(
reverse
(
'
FeedbackEdit
'
,
args
=
(
needs_review
[
0
].
slug
,)))
else
:
return
HttpResponseRedirect
(
self
.
get_success_url
())
else
:
# in_groups(self.request.user, ('Tutor',)):
return
HttpResponseRedirect
(
reverse
(
'
CreateFeedbackForType
'
,
args
=
(
form
.
instance
.
of_submission
.
type
.
slug
,)))
return
HttpResponseRedirect
(
reverse
(
'
CreateFeedbackForType
'
,
args
=
(
form
.
instance
.
of_submission
.
type
.
slug
,)))
return
HttpResponseRedirect
(
self
.
get_success_url
())
return
HttpResponseRedirect
(
self
.
get_success_url
())
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
...
...
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