Exemplo n.º 1
0
 def get_export_as_http_response(self, request):
     file_ref = self._get_file_ref()
     if file_ref:
         _file = file_ref.get_file_from_blobdb()
         content_format = Format('', 'json', '', True)
         return get_download_response(_file, file_ref.get_file_size(), content_format, self._blob_id(), request)
     else:
         return JsonResponse({"message": "Data is not updated for this month"})
Exemplo n.º 2
0
 def get_export_as_http_response(self, request):
     file_ref = self._get_file_ref()
     if file_ref:
         _file = file_ref.get_file_from_blobdb()
         content_format = Format('', 'json', '', True)
         return get_download_response(_file, file_ref.get_file_size(), content_format, self._blob_id(), request)
     else:
         from custom.icds_reports.tasks import build_missing_disha_dump
         args = [self.month, self.state_name]
         now = datetime.utcnow()
         if now.hour >= 14:
             # 14 hours should be when much after ICDS agg task would have finished by
             build_missing_disha_dump.delay(*args)
         else:
             build_missing_disha_dump.apply_async(
                 args=args,
                 eta=now.replace(hour=14)
             )
         return JsonResponse({"message": "Data is not updated for this month, please check after 14:00 UTC"})