mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix bug in test statistics generation
This commit is contained in:
parent
ad4a0e80db
commit
146cdec585
@ -1320,8 +1320,7 @@ class TestStatistics(GenericAPIView):
|
||||
)
|
||||
def get(self, request, pk, *args, **kwargs):
|
||||
"""Return test execution count matrix broken down by test result."""
|
||||
instance = self.get_object()
|
||||
serializer = self.get_serializer(instance)
|
||||
serializer = self.get_serializer(request.data)
|
||||
if request.resolver_match.url_name == 'api-test-statistics-by-part':
|
||||
serializer.context['type'] = 'by-part'
|
||||
elif request.resolver_match.url_name == 'api-test-statistics-by-build':
|
||||
|
@ -885,13 +885,15 @@ class TestStatisticsSerializer(serializers.Serializer):
|
||||
def to_representation(self, obj):
|
||||
"""Just pass through the test statistics from the model."""
|
||||
if self.context['type'] == 'by-part':
|
||||
return obj.part_test_statistics(
|
||||
return StockItemTestResult.part_test_statistics(
|
||||
{},
|
||||
self.context['pk'],
|
||||
self.context['finished_datetime_after'],
|
||||
self.context['finished_datetime_before'],
|
||||
)
|
||||
elif self.context['type'] == 'by-build':
|
||||
return obj.build_test_statistics(
|
||||
return StockItemTestResult.build_test_statistics(
|
||||
{},
|
||||
self.context['pk'],
|
||||
self.context['finished_datetime_after'],
|
||||
self.context['finished_datetime_before'],
|
||||
|
Loading…
Reference in New Issue
Block a user