From 81d099174de9eded9ef91a29ee7e2acd311bd567 Mon Sep 17 00:00:00 2001 From: Johan Castiblanco Date: Fri, 30 Jun 2023 12:02:04 -0500 Subject: [PATCH] feat: positive logic to the stats view 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 --- eox_nelp/stats/templates/tenant_stats.html | 10 ++++----- eox_nelp/stats/urls.py | 2 +- eox_nelp/stats/views.py | 26 +++++++++++----------- eox_nelp/urls.py | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/eox_nelp/stats/templates/tenant_stats.html b/eox_nelp/stats/templates/tenant_stats.html index 33b13edf..486c5427 100644 --- a/eox_nelp/stats/templates/tenant_stats.html +++ b/eox_nelp/stats/templates/tenant_stats.html @@ -8,11 +8,11 @@
diff --git a/eox_nelp/stats/urls.py b/eox_nelp/stats/urls.py index 783cf50c..fb2bdfc6 100644 --- a/eox_nelp/stats/urls.py +++ b/eox_nelp/stats/urls.py @@ -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 diff --git a/eox_nelp/stats/views.py b/eox_nelp/stats/views.py index 429a3e7e..76f812c6 100644 --- a/eox_nelp/stats/views.py +++ b/eox_nelp/stats/views.py @@ -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()) diff --git a/eox_nelp/urls.py b/eox_nelp/urls.py index 2d70d7c9..d3048358 100644 --- a/eox_nelp/urls.py +++ b/eox_nelp/urls.py @@ -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')), ]