Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MOOC packages by hacklab
django-courses-legacy
Commits
1590a955
Commit
1590a955
authored
4 years ago
by
Leonardo Piccioni de Almeida
Browse files
Options
Download
Email Patches
Plain Diff
Filter classrooms by text
parent
4f05f8fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
16 deletions
+25
-16
courses_legacy/static/js/reports/classroom-participation-report/classroom-participation-report.component.js
...pation-report/classroom-participation-report.component.js
+22
-13
courses_legacy/templates/components/classroom-participation-report.template.html
...s/components/classroom-participation-report.template.html
+3
-3
No files found.
courses_legacy/static/js/reports/classroom-participation-report/classroom-participation-report.component.js
View file @
1590a955
...
...
@@ -17,8 +17,9 @@
var
ctrl
=
this
;
ctrl
.
classrooms
=
null
;
ctrl
.
fetchClassrooms
=
throttleDebounce
.
debounce
(
1000
,
fetchClassrooms
);
ctrl
.
classrooms
=
[];
ctrl
.
filterClassrooms
=
filterClassrooms
;
ctrl
.
filteredClassrooms
=
[];
ctrl
.
minimized
=
false
;
ctrl
.
search
=
''
;
ctrl
.
toggleDetails
=
toggleDetails
;
...
...
@@ -31,21 +32,29 @@
function
fetchClassrooms
()
{
var
params
=
{
date
:
ctrl
.
date
};
if
(
ctrl
.
search
)
{
}
ClassroomReport
.
query
(
params
,
(
data
)
=>
{
ctrl
.
classrooms
=
data
;
ctrl
.
total
=
{
actives
:
0
,
not_actives
:
0
,
not_involved
:
0
,
total
:
0
};
ctrl
.
classrooms
.
forEach
(
classroom
=>
{
var
participation
=
classroom
.
participation
;
ctrl
.
total
.
actives
+=
participation
.
actives
;
ctrl
.
total
.
not_actives
+=
participation
.
not_actives
;
ctrl
.
total
.
not_involved
+=
participation
.
not_involved
;
ctrl
.
total
.
total
+=
participation
.
actives
+
participation
.
not_actives
+
participation
.
not_involved
;
filterClassrooms
();
});
}
function
filterClassrooms
()
{
if
(
ctrl
.
search
)
{
ctrl
.
filteredClassrooms
=
ctrl
.
classrooms
.
filter
(
classroom
=>
{
return
classroom
.
name
.
toLowerCase
().
includes
(
ctrl
.
search
.
toLowerCase
());
});
}
else
{
ctrl
.
filteredClassrooms
=
ctrl
.
classrooms
;
}
ctrl
.
total
=
{
actives
:
0
,
not_actives
:
0
,
not_involved
:
0
,
total
:
0
};
ctrl
.
filteredClassrooms
.
forEach
(
classroom
=>
{
const
participation
=
classroom
.
participation
;
ctrl
.
total
.
actives
+=
participation
.
actives
;
ctrl
.
total
.
not_actives
+=
participation
.
not_actives
;
ctrl
.
total
.
not_involved
+=
participation
.
not_involved
;
});
ctrl
.
total
.
total
=
ctrl
.
total
.
actives
+
ctrl
.
total
.
not_actives
+
ctrl
.
total
.
not_involved
;
}
function
toggleDetails
()
{
...
...
This diff is collapsed.
Click to expand it.
courses_legacy/templates/components/classroom-participation-report.template.html
View file @
1590a955
{% verbatim %}
<section
class=
"widget container-fluid"
ng-if=
"$ctrl.classrooms"
>
<section
class=
"widget container-fluid"
ng-if=
"$ctrl.classrooms
.length > 0
"
>
<header
class=
"widget-header"
>
<div
class=
"row"
>
<div
class=
"col-sm-12 col-md-12"
>
...
...
@@ -18,7 +18,7 @@
<main
class=
"widget-body"
ng-if=
"!$ctrl.minimized"
>
<div
class=
"filter-row"
>
<span>
Busque pelo nome da sala:
</span>
<input
name=
"classroom"
placeholder=
"Busque por uma sala"
aria-label=
"Sala de aula"
ng-model=
"$ctrl.search"
ng-change=
"$ctrl.f
etch
Classrooms()"
>
<input
name=
"classroom"
placeholder=
"Busque por uma sala"
aria-label=
"Sala de aula"
ng-model=
"$ctrl.search"
ng-change=
"$ctrl.f
ilter
Classrooms()"
>
</div>
<div
class=
"table-wrapper"
>
<table>
...
...
@@ -33,7 +33,7 @@
</thead>
<tbody>
<div>
<tr
ng-repeat=
"classroom in $ctrl.
c
lassrooms"
>
<tr
ng-repeat=
"classroom in $ctrl.
filteredC
lassrooms"
>
<td><b>
{{ classroom.name }}
</b></td>
<td>
{{ classroom.participation.actives }}
</td>
<td>
{{ classroom.participation.not_actives }}
</td>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment