Skip to content

Commit

Permalink
feat: positive logic to the stats view
Browse files Browse the repository at this point in the history
By default the view show all components. Then you can manage or filter which component
wouldnt be show setting it to false.
  • Loading branch information
johanseto committed Jun 30, 2023
1 parent 539ceab commit 36b5ef4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions eox_nelp/stats/templates/tenant_stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<body>
<div id="tenant-stats"></div>
<script>
var showVideos = "true" === "${showVideos}";
var showCourses = "true" === "${showCourses}";
var showProblems = "true" === "${showProblems}";
var showLearners = "true" === "${showLearners}";
var showInstructors = "true" === "${showInstructors}";
var showVideos = "true" === "${videos}";
var showCourses = "true" === "${courses}";
var showProblems = "true" === "${problems}";
var showLearners = "true" === "${learners}";
var showInstructors = "true" === "${instructors}";
</script>
<script src="${static.url('tenant_stats/js/tenant_stats.js')}"></script>
</body>
Expand Down
26 changes: 13 additions & 13 deletions eox_nelp/stats/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ def get_tenant_stats(request):
By default this show nothing since this requires the specific query para to show the content.
Examples:
renders just video card /eox-nelp/stats/tenant/?showVideos=true
by default the view render all componets: /eox-nelp/stats/tenant/
render multiple components
/eox-nelp/stats/tenant/?showVideos=true&showCourses=true&showInstructors=true
filter components: eg dont show videos and courses.
/eox-nelp/stats/tenant/?videos=False&courses=false
The available options are:
showVideos
showCourses
showLearners
showInstructors
showProblems
videos
courses
learners
instructors
problems
"""

context = {
"showCourses": "false",
"showVideos": "false",
"showProblems": "false",
"showLearners": "false",
"showInstructors": "false",
"courses": "true",
"videos": "true",
"problems": "true",
"learners": "true",
"instructors": "true",
}
context.update(request.GET.dict())

Expand Down

0 comments on commit 36b5ef4

Please sign in to comment.