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.

feat: use frontend as experience use it

This would be considered in future of the need of a refactor,
but by the moment is better to have the templates views that use react
with the same shape.

chore: apply suggestions from code review
  • Loading branch information
johanseto committed Jun 30, 2023
1 parent 3c81d49 commit 81d0991
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 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
2 changes: 1 addition & 1 deletion eox_nelp/stats/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""frontend templates urls for course_experience"""
"""frontend templates urls for stats"""
from django.urls import path

from eox_nelp.stats.views import get_tenant_stats
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
2 changes: 1 addition & 1 deletion eox_nelp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
include('eox_nelp.course_experience.frontend.urls', namespace='course-experience-frontend'),
),
path('api/stats/', include('eox_nelp.stats.api.urls', namespace='stats-api')),
path('stats/', include('eox_nelp.stats.urls', namespace='stats')),
path('frontend/stats/', include('eox_nelp.stats.urls', namespace='stats')),
]

0 comments on commit 81d0991

Please sign in to comment.