-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #849 from ImageMarkup/isic-169-stats-endpoint
Add API endpoint for stats
- Loading branch information
Showing
5 changed files
with
65 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from django.http.request import HttpRequest | ||
from ninja import Router | ||
|
||
from isic.stats.views import get_archive_stats | ||
|
||
stats_router = Router() | ||
|
||
|
||
@stats_router.get("/", response=dict, summary="Return ISIC Archive statistics.") | ||
def stats(request: HttpRequest): | ||
archive_stats = get_archive_stats() | ||
|
||
del archive_stats["engagement"]["30_day_sessions_per_country"] | ||
return archive_stats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django.urls.base import reverse | ||
import pytest | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_api_stats(client): | ||
r = client.get(reverse("api:stats")) | ||
assert r.status_code == 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters