From 88ee6ec289bd7a3608ed48f24b6f69110dc7abac Mon Sep 17 00:00:00 2001 From: Odumosu Dipo Date: Wed, 16 Oct 2019 21:04:29 +0100 Subject: [PATCH 01/12] chore: remove unnecessary task --- apollo/formsframework/tasks.py | 20 -------------------- apollo/tasks.py | 1 - 2 files changed, 21 deletions(-) delete mode 100644 apollo/formsframework/tasks.py diff --git a/apollo/formsframework/tasks.py b/apollo/formsframework/tasks.py deleted file mode 100644 index fbc6c0760..000000000 --- a/apollo/formsframework/tasks.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -from .. import services -from ..factory import create_celery_app - -celery = create_celery_app() - - -@celery.task -def update_submissions(form_pk): - ''' - Updates submissions after a form has been updated, so all the fields - in the form are existent in the submissions. - ''' - form = services.forms.get(pk=form_pk) - tags = form.tags - for submission in services.submissions.find(form=form): - for tag in tags: - if not hasattr(submission, tag): - setattr(submission, tag, None) - submission.save() diff --git a/apollo/tasks.py b/apollo/tasks.py index 907009675..8c5da75ec 100644 --- a/apollo/tasks.py +++ b/apollo/tasks.py @@ -3,7 +3,6 @@ celery = create_celery_app() -from apollo.formsframework.tasks import update_submissions from apollo.messaging.tasks import send_messages, send_email from apollo.participants.tasks import import_participants from apollo.locations.tasks import import_locations From 7df34882edd46105276f680fcdf581fd939cead7 Mon Sep 17 00:00:00 2001 From: Odumosu Dipo Date: Tue, 22 Oct 2019 12:05:32 +0100 Subject: [PATCH 02/12] feat: add task label to info --- apollo/factory.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apollo/factory.py b/apollo/factory.py index 72a27d716..8fe71b0ec 100644 --- a/apollo/factory.py +++ b/apollo/factory.py @@ -189,6 +189,7 @@ def on_failure(self, exc, task_id, args, kwargs, einfo): 'progress': self.task_info, 'description': TASK_DESCRIPTIONS.get(self.request.task, _('Task')), 'quit': True, + 'name': self.request.task.split('.')[-1], } if channel is not None: @@ -207,6 +208,7 @@ def on_success(self, retval, task_id, args, kwargs): 'progress': self.task_info, 'description': TASK_DESCRIPTIONS.get(self.request.task, _('Task')), 'quit': True, + 'name': self.request.task.split('.')[-1], } if channel is not None: From 96f771fbfff345b67e8bdf6a50eb53fdff1188e0 Mon Sep 17 00:00:00 2001 From: Odumosu Dipo Date: Wed, 23 Oct 2019 20:26:06 +0100 Subject: [PATCH 03/12] feat: implement locations import toast --- apollo/factory.py | 2 + apollo/locations/views_locations.py | 1 + apollo/templates/admin/locations_list.html | 151 +++++++++++++++++++++ 3 files changed, 154 insertions(+) diff --git a/apollo/factory.py b/apollo/factory.py index 8fe71b0ec..18f17f110 100644 --- a/apollo/factory.py +++ b/apollo/factory.py @@ -230,6 +230,8 @@ def update_task_info(self, **kwargs): 'status': _('RUNNING'), 'progress': task_metadata.get('result'), 'description': TASK_DESCRIPTIONS.get(self.request.task, _('Task')) + 'name': self.request.task.split('.')[-1], + 'quit': False, } if channel is not None: diff --git a/apollo/locations/views_locations.py b/apollo/locations/views_locations.py index d1c386971..0c59d0438 100644 --- a/apollo/locations/views_locations.py +++ b/apollo/locations/views_locations.py @@ -95,6 +95,7 @@ def locations_list(view, location_set_id): else: ctx = dict( args=args, + channel=session.get('_id'), extra_fields=extra_fields, filter_form=queryset_filter.form, breadcrumbs=breadcrumbs, diff --git a/apollo/templates/admin/locations_list.html b/apollo/templates/admin/locations_list.html index 9703af5df..5b72e7326 100644 --- a/apollo/templates/admin/locations_list.html +++ b/apollo/templates/admin/locations_list.html @@ -127,6 +127,11 @@

{{ _('Finalize') }}

+
+
+ +
+