mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-28 06:28:43 +01:00
Few enhancements.
This commit is contained in:
@@ -26,6 +26,8 @@ class DMARCViewSet(GetThrottleViewsetMixin, viewsets.GenericViewSet):
|
||||
)
|
||||
def alignment_stats(self, request, **kwargs):
|
||||
domain = self.get_object()
|
||||
if not domain.record_set.exists():
|
||||
return response.Response(status=204)
|
||||
try:
|
||||
stats = lib.get_aligment_stats(
|
||||
domain, self.request.query_params.get("period")
|
||||
|
||||
@@ -263,8 +263,8 @@ def get_aligment_stats(domain, period=None) -> dict:
|
||||
report__end_date__lte=daterange[1])) &
|
||||
Q(header_from=domain)
|
||||
)
|
||||
all_records = models.Record.objects.select_related().filter(qargs)
|
||||
stats = {
|
||||
all_records = models.Record.objects.filter(qargs)
|
||||
stats: dict = {
|
||||
"aligned": {},
|
||||
"trusted": {},
|
||||
"forwarded": {},
|
||||
|
||||
Reference in New Issue
Block a user