Skip to content

Commit

Permalink
Move test statistics API urls to a separate endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
martonmiklos committed Jun 24, 2024
1 parent 2ab8303 commit e21fd4a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
2 changes: 2 additions & 0 deletions src/backend/InvenTree/InvenTree/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from order.urls import order_urls
from part.urls import part_urls
from plugin.urls import get_plugin_urls
from stock.api import test_statistics_api_urls
from stock.urls import stock_urls
from web.urls import api_urls as web_api_urls
from web.urls import urlpatterns as platform_urls
Expand Down Expand Up @@ -101,6 +102,7 @@
]),
),
path('stock/', include(stock.api.stock_api_urls)),
path('test-statistics/', include(test_statistics_api_urls)),
path('build/', include(build.api.build_api_urls)),
path('order/', include(order.api.order_api_urls)),
path('label/', include(report.api.label_api_urls)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ <h3>

{% if build.part.trackable > 0 %}
onPanelLoad("test-statistics", function() {
prepareTestStatisticsTable('build', '{% url "api-stock-test-statistics" "by-build" build.pk %}')
prepareTestStatisticsTable('build', '{% url "api-test-statistics/by-build" build.pk %}')
});
{% endif %}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion src/backend/InvenTree/part/templates/part/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ <h4>{% trans "Part Manufacturers" %}</h4>
});
});
onPanelLoad("test-statistics", function() {
prepareTestStatisticsTable('part', '{% url "api-stock-test-statistics" "by-part" part.pk %}')
prepareTestStatisticsTable('part', '{% url "api-test-statistics" "by-part" part.pk %}')
});

onPanelLoad("part-stock", function() {
Expand Down
26 changes: 10 additions & 16 deletions src/backend/InvenTree/stock/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1657,22 +1657,6 @@ def destroy(self, request, *args, **kwargs):
),
]),
),
# Test statistics endpoints
path(
'test-statistics/',
include([
path(
'<str:type>/',
include([
path(
'<int:pk>/',
TestStatistics.as_view(),
name='api-stock-test-statistics',
)
]),
)
]),
),
# StockItemTracking API endpoints
path(
'track/',
Expand Down Expand Up @@ -1728,3 +1712,13 @@ def destroy(self, request, *args, **kwargs):
# Anything else
path('', StockList.as_view(), name='api-stock-list'),
]

test_statistics_api_urls = [
# Test statistics endpoints
path(
'<str:type>/',
include([
path('<int:pk>/', TestStatistics.as_view(), name='api-test-statistics')
]),
)
]

0 comments on commit e21fd4a

Please sign in to comment.