Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Postal Owl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Postal Owl
Postal Owl
Commits
90ed473b
Commit
90ed473b
authored
4 months ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Teacher/JS: Displaying graders
parent
83141429
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
owl/teacher.py
+25
-0
25 additions, 0 deletions
owl/teacher.py
static/owl.css
+20
-0
20 additions, 0 deletions
static/owl.css
static/teacher.js
+20
-0
20 additions, 0 deletions
static/teacher.js
with
65 additions
and
0 deletions
owl/teacher.py
+
25
−
0
View file @
90ed473b
...
...
@@ -165,6 +165,18 @@ def teacher(sident: str, cident: str):
except
KeyError
:
pass
have_graders
=
js_mode
and
(
g
.
course
.
split_grading
or
g
.
course
.
student_grading
)
topic_graders
:
Dict
[
int
,
List
[
Tuple
[
db
.
User
,
bool
]]]
=
{
tid
:
[]
for
tid
in
topics
.
keys
()}
if
have_graders
:
for
grader
,
user
in
list
(
sess
.
execute
(
select
(
db
.
Grader
,
db
.
User
)
.
select_from
(
db
.
Grader
)
.
join
(
db
.
Grader
.
user
)
.
filter
(
db
.
Grader
.
tid
.
in_
(
topics
.
keys
()))
.
order_by
(
db
.
User
.
last_name
,
db
.
User
.
last_name
)
)):
topic_graders
[
grader
.
tid
].
append
((
user
,
grader
.
student_grader
))
auto_grid
=
owl
.
auto_eval
.
eval_queue_grid
(
topic_list
)
for
key
,
auto
in
auto_grid
.
items
():
gtid
,
guid
=
key
...
...
@@ -182,6 +194,7 @@ def teacher(sident: str, cident: str):
# app.logger.debug(students)
# app.logger.debug(solutions)
# app.logger.debug(totals)
# app.logger.debug(topic_graders)
def
to_json
():
tops
=
[]
...
...
@@ -192,6 +205,17 @@ def teacher(sident: str, cident: str):
tj
[
'
t_link
'
]
=
url_for
(
'
topic_index
'
,
sident
=
g
.
course
.
semester
.
ident
,
cident
=
g
.
course
.
ident
,
tident
=
t
.
ident
)
if
t
.
deadline
is
not
None
:
tj
[
'
t_deadline
'
]
=
owl
.
jinja
.
reltimeformat
(
t
.
deadline
)
if
have_graders
:
tgr
=
topic_graders
[
t
.
tid
]
if
g
.
course
.
split_grading
:
tj
[
'
t_am_grader
'
]
=
any
(
u
.
uid
==
g
.
uid
for
u
,
_
in
tgr
)
else
:
tj
[
'
t_am_grader
'
]
=
True
tj
[
'
t_graders
'
]
=
[
u
.
full_name
()
+
(
"
(student)
"
if
is_student
else
""
)
for
u
,
is_student
in
tgr
]
tj
[
'
t_graders_short
'
]
=
[
u
.
first_name
[
0
]
+
u
.
last_name
[
0
]
for
u
,
_
in
tgr
]
tj
[
'
t_student_graders
'
]
=
any
(
is_student
for
_
,
is_student
in
tgr
)
tj
[
'
t_teacher_graders
'
]
=
any
(
not
is_student
for
_
,
is_student
in
tgr
)
tj
[
'
t_grader_link
'
]
=
url_for
(
'
admin_topic_graders
'
,
sident
=
g
.
course
.
semester
.
ident
,
cident
=
g
.
course
.
ident
,
tid
=
t
.
tid
)
tops
.
append
(
tj
)
if
t
.
tid
in
topics_followed_by_header
:
group
+=
1
...
...
@@ -237,6 +261,7 @@ def teacher(sident: str, cident: str):
'
course_max
'
:
float
(
course_total
),
'
pass_threshold
'
:
float
(
g
.
course
.
pass_threshold
)
if
g
.
course
.
pass_threshold
is
not
None
else
None
,
'
show_uids
'
:
g
.
course
.
anon_grading
,
'
have_graders
'
:
have_graders
,
}
return
json
.
JSONEncoder
(
ensure_ascii
=
False
,
indent
=
1
).
encode
(
out
)
...
...
This diff is collapsed.
Click to expand it.
static/owl.css
+
20
−
0
View file @
90ed473b
...
...
@@ -390,6 +390,26 @@ footer {
text-align
:
center
;
}
/* Graders */
#results
.grading
th
{
text-align
:
center
;
}
#results
.grading
td
{
text-align
:
center
;
}
#results
td
.grme
{
background-color
:
#b162ee
;
font-size
:
smaller
;
}
#results
td
.grother
{
background-color
:
#62beee
;
font-size
:
smaller
;
}
#results
td
.grstud
{
background-color
:
#62ee96
;
font-size
:
smaller
;
}
/* Settings */
.settings
{
...
...
This diff is collapsed.
Click to expand it.
static/teacher.js
+
20
−
0
View file @
90ed473b
...
...
@@ -167,6 +167,26 @@ class teachersView {
total
.
addText
(
s
.
t_total
.
toFixed
(
2
));
}
renderGraders
()
{
const
grading
=
this
.
table
.
addChild
(
'
tr
'
).
addClass
(
'
grading
'
);
grading
.
addChild
(
'
th
'
).
addText
(
'
Graders
'
);
for
(
const
[
t
,
g
]
of
this
.
topicCells
(
grading
))
{
const
a
=
g
.
addChild
(
'
a
'
);
a
.
e
.
href
=
t
.
t_grader_link
;
if
(
t
.
t_graders
.
length
>
0
)
{
g
.
e
.
title
=
t
.
t_graders
.
join
(
"
,
"
);
g
.
addClass
(
t
.
t_am_grader
?
'
grme
'
:
t
.
t_student_graders
?
'
grstud
'
:
'
grother
'
);
let
text
=
t
.
t_graders_short
[
0
]
if
(
t
.
t_graders_short
.
length
>
1
)
text
+=
"
+
"
;
a
.
addText
(
text
);
}
else
{
a
.
addText
(
'
✐
'
);
}
}
grading
.
addChild
(
'
td
'
).
addClass
(
'
tnextgroup
'
);
}
*
topicCells
(
row
,
element
=
'
td
'
)
{
let
prev_group
=
-
1
;
for
(
const
t
of
this
.
visible_topics
)
{
...
...
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