basic stats page
This commit is contained in:
@@ -153,6 +153,7 @@ urlpatterns = [
|
||||
#path("cookies/", include("cookie_consent.urls")),
|
||||
path("privacy/", views.privacy_view, name="privacy"),
|
||||
path("about/", views.about_view, name="about"),
|
||||
path("stats/", views.stats, name="stats"),
|
||||
# path('select2/', include('select2.urls')),
|
||||
|
||||
path("ac/", autocomplete_urls),
|
||||
@@ -180,6 +181,8 @@ urlpatterns = [
|
||||
),
|
||||
|
||||
path("cimar/login/", views.cimar_login, name="cimar_login"),
|
||||
path("cimar/logout/", views.cimar_logout, name="cimar_logout"),
|
||||
path("cimar/login/status", views.cimar_status, name="cimar_status"),
|
||||
|
||||
]
|
||||
|
||||
|
||||
+27
-1
@@ -3,7 +3,7 @@ from typing import Any, Optional
|
||||
from django.conf import settings
|
||||
|
||||
from django_tables2 import SingleTableMixin
|
||||
from atlas.models import CaseCollection, CidReportAnswer
|
||||
from atlas.models import CaseCollection, CidReportAnswer, Case as AtlasCase
|
||||
from generic.decorators import user_is_cid_user_manager
|
||||
from generic.filters import UserUserFilter
|
||||
from generic.tables import UserUserTable
|
||||
@@ -521,6 +521,20 @@ def cimar(request):
|
||||
def about_view(request):
|
||||
return render(request, "about.html")
|
||||
|
||||
|
||||
def stats(request):
|
||||
collection_count = CaseCollection.objects.filter(archive=False).count()
|
||||
case_count = AtlasCase.objects.filter().count()
|
||||
|
||||
anatomy_exam_count = AnatomyExam.objects.filter(archive=False).count()
|
||||
anatomy_question_count = AnatomyQuestion.objects.filter().count()
|
||||
return render(request, "stats.html"
|
||||
, {"collection_count": collection_count,
|
||||
"case_count": case_count,
|
||||
"anatomy_exam_count": anatomy_exam_count,
|
||||
"anatomy_question_count": anatomy_question_count
|
||||
})
|
||||
|
||||
# HTTP Error 400
|
||||
def page_not_found(request, exception):
|
||||
response = render(request, "404.html")
|
||||
@@ -954,6 +968,18 @@ def cimar_study_series_block(request, uuid):
|
||||
|
||||
return render(request, "cimar_series.html", {"series_data": case.series_data["series"], "cimar_sid": request.user.userprofile.cimar_sid})
|
||||
|
||||
def cimar_status(request):
|
||||
login_status = CimarAPI(request.user.userprofile.cimar_sid).check_login_status()
|
||||
|
||||
if login_status:
|
||||
return HttpResponse("")
|
||||
else:
|
||||
return render(request, "cimar_login.html#login-block", {"login_status": login_status, "cimar_sid": request.user.userprofile.cimar_sid})
|
||||
|
||||
def cimar_logout(request):
|
||||
CimarAPI(request.user.userprofile.cimar_sid).logout()
|
||||
return HttpResponse("Logged out")
|
||||
|
||||
def cimar_login(request):
|
||||
|
||||
if request.htmx:
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="anatomy">
|
||||
<h1>Stats</h1>
|
||||
|
||||
<h2>Atlas</h2>
|
||||
|
||||
<h3>Collections</h3>
|
||||
Count: {{ collection_count }}<br/>
|
||||
|
||||
<h3>Cases</h3>
|
||||
Count: {{ case_count }}<br/>
|
||||
|
||||
<h2>Anatomy</h2>
|
||||
Exams: {{ anatomy_exam_count }}<br/>
|
||||
Questions: {{ anatomy_question_count }}<br/>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user