Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisRayM committed Mar 13, 2023
1 parent edad6b2 commit 0257f40
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions onadata/apps/api/viewsets/v2/messaging_stats_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class MessagingStatsViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
The endpoint accepts the following query parameters:
- `group_by`: field specifying whether to group events by `day`, `month` or `year`
- `target_type`: field to be used to determine the target object type i.e xform, project
- `target_type`: field to be used to determine the target
object type i.e xform, project
- `target_id`: field used to identify the target object
Example:
Expand Down Expand Up @@ -77,7 +78,8 @@ def _generate_annotated_queryset(self, request, queryset):
field = request.query_params.get("group_by")
if field is None:
raise exceptions.ParseError(_("Parameter 'group_by' is missing."))
elif field not in self.SUPPORTED_GROUP_BY.keys():

if field not in self.SUPPORTED_GROUP_BY:
raise exceptions.ParseError(_("Parameter 'group_by' is not valid."))

group_format = self.SUPPORTED_GROUP_BY[field]
Expand All @@ -92,7 +94,7 @@ def list(self, request, *args, **kwargs):
queryset = self._generate_annotated_queryset(
request, self.filter_queryset(self.get_queryset())
)
response = StreamingHttpResponse(
response = StreamingHttpResponse( # pylint: disable=http-response-with-content-type-json
self._stream_annotated_queryset(queryset), content_type="application/json"
)
return response

0 comments on commit 0257f40

Please sign in to comment.