Skip to content

Commit

Permalink
Revert public users to see data pass 3 months
Browse files Browse the repository at this point in the history
  • Loading branch information
karimkawambwa committed Jun 26, 2019
1 parent 1adec79 commit ae7e3b6
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions sensorsafrica/api/v2/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,8 @@ class CityView(mixins.ListModelMixin, viewsets.GenericViewSet):
class NodesView(viewsets.ViewSet):
def list(self, request):
nodes = []

public_threshold = timezone.now() - relativedelta(months=3)
lastactive_queryset = LastActiveNodes.objects.filter(last_data_received_at__gte=public_threshold)
if self.request.user.is_authenticated():
if self.request.user.groups.filter(name="show_me_everything").exists():
lastactive_queryset = LastActiveNodes.objects.all()

# Loop through the last active nodes
for last_active in lastactive_queryset.iterator():
for last_active in LastActiveNodes.objects.iterator():
# Get the current node
node = Node.objects.filter(
Q(id=last_active.node.id), ~Q(sensors=None)
Expand Down

0 comments on commit ae7e3b6

Please sign in to comment.