Skip to content

Commit

Permalink
feat: use query params in snake case
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-canon committed Jul 5, 2023
1 parent 614f910 commit 4c85d62
Show file tree
Hide file tree
Showing 3 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" === "${show_videos}";
var showCourses = "true" === "${show_courses}";
var showProblems = "true" === "${show_problems}";
var showLearners = "true" === "${show_learners}";
var showInstructors = "true" === "${show_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/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_get_default_stats(self):
self.assertEqual(self.template_name, response.templates[0].name)
self.assertContains(response, '<div id="tenant-stats"></div')

@data("showVideos", "showCourse", "showProblems", "showInstructors", "showLearners")
@data("show_videos", "show_course", "show_problems", "show_instructors", "show_learners")
def test_get_specific_stat(self, query_param):
"""
Test that the view render successfully when a query param is included
Expand Down
24 changes: 12 additions & 12 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
renders just video card /eox-nelp/stats/tenant/?show_videos=true
render multiple components
/eox-nelp/stats/tenant/?showVideos=true&showCourses=true&showInstructors=true
/eox-nelp/stats/tenant/?show_videos=true&show_courses=true&show_instructors=true
The available options are:
showVideos
showCourses
showLearners
showInstructors
showProblems
show_videos
show_courses
show_learners
show_instructors
show_problems
"""

context = {
"showCourses": "false",
"showVideos": "false",
"showProblems": "false",
"showLearners": "false",
"showInstructors": "false",
"show_courses": "false",
"show_videos": "false",
"show_problems": "false",
"show_learners": "false",
"show_instructors": "false",
}
context.update(request.GET.dict())

Expand Down

0 comments on commit 4c85d62

Please sign in to comment.