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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Postal Owl
Postal Owl
Commits
56f83397
Commit
56f83397
authored
4 months ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Teacher/JS: Mode "my posts needing attention"
parent
90ed473b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
owl/templates/teacher-js.html
+3
-1
3 additions, 1 deletion
owl/templates/teacher-js.html
static/teacher.js
+16
-2
16 additions, 2 deletions
static/teacher.js
with
19 additions
and
3 deletions
owl/templates/teacher-js.html
+
3
−
1
View file @
56f83397
...
@@ -22,7 +22,8 @@
...
@@ -22,7 +22,8 @@
<div
class=
buttons
>
<div
class=
buttons
>
<button
id=
"mode_all"
onclick=
"tv.setMode(TMODE_ALL)"
>
All
</button>
<button
id=
"mode_all"
onclick=
"tv.setMode(TMODE_ALL)"
>
All
</button>
<button
id=
"mode_attn"
onclick=
"tv.setMode(TMODE_ATTN)"
>
Unresolved
</button>
<button
id=
"mode_attn"
onclick=
"tv.setMode(TMODE_ATTN)"
title=
"Threads with unanswered posts"
>
Unresolved
</button>
<button
id=
"mode_my"
onclick=
"tv.setMode(TMODE_MY)"
title=
"Threads with unanswered posts in topics where I am a grader"
>
My unresolved
</button>
<a
class=
button
href=
'{{ url_for('
results_json
',
sident=
c.semester.ident,
cident=
c.ident)
}}'
>
JSON
</a>
<a
class=
button
href=
'{{ url_for('
results_json
',
sident=
c.semester.ident,
cident=
c.ident)
}}'
>
JSON
</a>
<a
class=
button
href=
'{{ url_for('
results_csv
',
sident=
c.semester.ident,
cident=
c.ident)
}}'
>
CSV
</a>
<a
class=
button
href=
'{{ url_for('
results_csv
',
sident=
c.semester.ident,
cident=
c.ident)
}}'
>
CSV
</a>
...
@@ -73,6 +74,7 @@
...
@@ -73,6 +74,7 @@
<script>
<script>
const
tv
=
new
teachersView
({{
json_data
|
safe
}});
const
tv
=
new
teachersView
({{
json_data
|
safe
}});
{
%
if
'
mattn
'
in
color_defaults
%
}
tv
.
mode
=
TMODE_ATTN
;{
%
endif
%
}
{
%
if
'
mattn
'
in
color_defaults
%
}
tv
.
mode
=
TMODE_ATTN
;{
%
endif
%
}
{
%
if
'
mmy
'
in
color_defaults
%
}
tv
.
mode
=
TMODE_MY
;{
%
endif
%
}
tv
.
render
();
tv
.
render
();
tv
.
recalcToggles
();
tv
.
recalcToggles
();
view
.
style
.
display
=
'
block
'
;
view
.
style
.
display
=
'
block
'
;
...
...
This diff is collapsed.
Click to expand it.
static/teacher.js
+
16
−
2
View file @
56f83397
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
const
TMODE_ALL
=
0
;
const
TMODE_ALL
=
0
;
const
TMODE_ATTN
=
1
;
const
TMODE_ATTN
=
1
;
const
TMODE_MY
=
2
;
class
htmlBuilder
{
class
htmlBuilder
{
constructor
(
e
)
{
constructor
(
e
)
{
...
@@ -35,6 +36,7 @@ class teachersView {
...
@@ -35,6 +36,7 @@ class teachersView {
this
.
course_max
=
json_data
.
course_max
;
this
.
course_max
=
json_data
.
course_max
;
this
.
pass_threshold
=
json_data
.
pass_threshold
;
this
.
pass_threshold
=
json_data
.
pass_threshold
;
this
.
show_uids
=
json_data
.
show_uids
;
this
.
show_uids
=
json_data
.
show_uids
;
this
.
have_graders
=
json_data
.
have_graders
;
this
.
mode
=
TMODE_ALL
;
this
.
mode
=
TMODE_ALL
;
console
.
log
(
"
Teacher: Initialized
"
);
console
.
log
(
"
Teacher: Initialized
"
);
}
}
...
@@ -49,14 +51,19 @@ class teachersView {
...
@@ -49,14 +51,19 @@ class teachersView {
this
.
renderMaxima
();
this
.
renderMaxima
();
for
(
const
s
of
this
.
visible_students
)
for
(
const
s
of
this
.
visible_students
)
this
.
renderStudent
(
s
);
this
.
renderStudent
(
s
);
if
(
this
.
have_graders
)
this
.
renderGraders
();
}
}
select
()
{
select
()
{
if
(
this
.
mode
==
TMODE_ATTN
)
{
if
(
this
.
mode
==
TMODE_ATTN
||
this
.
mode
==
TMODE_MY
)
{
const
stud
=
new
Set
();
const
stud
=
new
Set
();
const
top
=
new
Set
();
const
top
=
new
Set
();
let
topics
=
this
.
topics
;
if
(
this
.
mode
==
TMODE_MY
&&
this
.
have_graders
)
topics
=
topics
.
filter
((
t
)
=>
t
.
t_am_grader
||
!
t
.
t_teacher_graders
);
for
(
const
s
of
this
.
students
)
{
for
(
const
s
of
this
.
students
)
{
for
(
const
t
of
this
.
topics
)
{
for
(
const
t
of
topics
)
{
const
sol
=
this
.
solutions
[
s
.
uid
][
t
.
tid
];
const
sol
=
this
.
solutions
[
s
.
uid
][
t
.
tid
];
if
(
sol
&&
sol
.
l
==
'
n
'
)
{
if
(
sol
&&
sol
.
l
==
'
n
'
)
{
stud
.
add
(
s
.
uid
);
stud
.
add
(
s
.
uid
);
...
@@ -231,9 +238,16 @@ class teachersView {
...
@@ -231,9 +238,16 @@ class teachersView {
tokens
.
push
(
"
mattn
"
);
tokens
.
push
(
"
mattn
"
);
mode_all
.
classList
.
remove
(
"
active
"
);
mode_all
.
classList
.
remove
(
"
active
"
);
mode_attn
.
classList
.
add
(
"
active
"
);
mode_attn
.
classList
.
add
(
"
active
"
);
mode_my
.
classList
.
remove
(
"
active
"
);
}
else
if
(
this
.
mode
==
TMODE_MY
)
{
tokens
.
push
(
"
mmy
"
);
mode_all
.
classList
.
remove
(
"
active
"
);
mode_attn
.
classList
.
remove
(
"
active
"
);
mode_my
.
classList
.
add
(
"
active
"
);
}
else
{
}
else
{
mode_all
.
classList
.
add
(
"
active
"
);
mode_all
.
classList
.
add
(
"
active
"
);
mode_attn
.
classList
.
remove
(
"
active
"
);
mode_attn
.
classList
.
remove
(
"
active
"
);
mode_my
.
classList
.
remove
(
"
active
"
);
}
}
document
.
cookie
=
"
owl_colors=
"
+
tokens
.
join
(
"
:
"
)
+
"
; max-age=31536000; path={{ url_for('index') }}
"
;
document
.
cookie
=
"
owl_colors=
"
+
tokens
.
join
(
"
:
"
)
+
"
; max-age=31536000; path={{ url_for('index') }}
"
;
...
...
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