Commit 12e5aa6dad0798573d4e80af29c76cbc425bf3f3
1 parent
ba3bf72d
Exists in
master
and in
2 other branches
removed responsabilities from subjects app and sent to analytics one
Showing
2 changed files
with
0 additions
and
24 deletions
Show diff stats
subjects/urls.py
... | ... | @@ -18,7 +18,6 @@ urlpatterns = [ |
18 | 18 | url(r'^search/(?P<option>[\w_-]+)/$', views.SubjectSearchView.as_view(), name='search'), |
19 | 19 | url(r'^load_subs/(?P<slug>[\w_-]+)/$', views.GetSubjectList.as_view(), name='load_view'), |
20 | 20 | url(r'^view_log/(?P<subject>[\w_-]+)/$', views.subject_view_log, name = 'view_log'), |
21 | - url(r'^most_accessed_subjects/$', views.most_acessed_subjects, name='most_acessed'), | |
22 | 21 | url(r'^report/', include('reports.urls', namespace='reports')), |
23 | 22 | url(r'^(?P<option>[\w_-]+)/$', views.IndexView.as_view(), name='index'), |
24 | 23 | ... | ... |
subjects/views.py
... | ... | @@ -713,29 +713,6 @@ def subject_view_log(request, subject): |
713 | 713 | return JsonResponse({'message': 'ok'}) |
714 | 714 | |
715 | 715 | |
716 | -""" | |
717 | -Subject view that returns a list of the most used subjects """ | |
718 | - | |
719 | -@login_required | |
720 | -def most_acessed_subjects(request): | |
721 | - data = {} #empty response | |
722 | - | |
723 | - data = Log.objects.filter(resource = 'subject') | |
724 | - subjects = {} | |
725 | - for datum in data: | |
726 | - if datum.context: | |
727 | - subject_id = datum.context['subject_id'] | |
728 | - if subject_id in subjects.keys(): | |
729 | - subjects[subject_id]['count'] = subjects[subject_id]['count'] + 1 | |
730 | - else: | |
731 | - subjects[subject_id] = {'name': datum.context['subject_name'], 'count':0 } | |
732 | - | |
733 | - | |
734 | - #order the values of the dictionary by the count in descendent order | |
735 | - subjects = sorted(subjects.values(), key = lambda x: x['count'], reverse=True ) | |
736 | - subjects = subjects[:30] | |
737 | - | |
738 | - return JsonResponse(subjects, safe=False) | |
739 | 716 | |
740 | 717 | """ BACKUP / RESTORE SECTION """ |
741 | 718 | class Backup(LoginRequiredMixin, ListView): | ... | ... |